SAN FRANCISCO, JAN. 21 -- BankAmerica Corp. today reported its worst annual loss, nearly $1 billion in 1987, but said it managed to post a profit during the fourth quarter when operating income surged.

Analysts forecast continued recovery for the wounded banking giant, which like many other banks felt the pinch in its balance sheet because of its decision to raise foreign loan-loss reserves and write off some of those loans.

Net income for the three months ended Dec. 31 totaled $60 million (27 cents per share), down from a profit of $82 million (44 cents) in the 1986 period. The previous year's profit included a $236 million net gain from the sale of BankAmerica's Italian bank unit. For the year, BankAmerica's losses widened to $955 million from $518 million in 1986.

But industry experts saw some improvement in the nation's third-largest bank holding company -- thanks to a two-year restructuring plan that included paring down its businesses, cutting its work force and concentrating on profitable domestic loans instead of risky foreign debt.

BankAmerica had about $100 million in operating income in the fourth quarter, excluding $38 million in Brazilian interest payments not shown as income because of accounting procedures.

That followed a third-quarter operating profit of $47 million after five quarters of operating in the red. Net income in the third quarter was $54 million (25 cents).

"Each quarter BankAmerica has a number of extraordinary, nonrecurring items, asset sales and expenses that muddy the water in terms of what the underlying profitability of the bank is," said Joseph Arsenio, a banking analyst with Birr, Wilson & Co. in San Francisco. "The important number is their operating profit and that looks good and shows they're on the road to recovery." BankAmerica cut its work force by about 9,000 last year, bringing total cuts over past two years to 18,600.

BankAmerica's huge 1987 loss resulted largely from a $1.1 billion second-quarter addition to its reserves for future loan losses in developing countries.