Exxon Corp. yesterday said its profit rose by 5.1 percent in the fourth quarter, helping lessen a decline in annual earnings caused by rising oil prices, which squeezed profit margins for refined products.

Separately, Atlantic Richfield Co. reported that its fourth-quarter profit quintupled from a year earlier, and Ashland Oil Inc. posted sharply higher profit in its first quarter.

Exxon -- the nation's biggest oil company -- reported net income of $1.56 billion ($1.12 per share) in the three months ended Dec. 31, compared with a profit of $1.48 billion ($1.03) in the same period of 1986. The New York company's revenue in the quarter rose to $22.6 billion, from $19.1 billion a year earlier.

For all of 1987 Exxon earned $4.84 billion ($3.43), down from $5.36 billion ($3.71) in 1986. Annual revenue rose to $84.1 billion from $76.5 billion.

Los Angeles-based Arco posted a fourth-quarter profit of $340 million ($1.86 per share), compared with $64 million (35 cents) in the year-earlier quarter. Revenue rose to $4.6 billion from $3.6 billion.

For the full year, Arco had a profit of $1.22 billion ($6.68), compared with $615 million ($3.38) in 1986. Annual revenue rose to $16.8 billion from $15 billion.

Ashland, based in Ashland, Ky., reported a profit of $71.1 million ($2.50 per share) in the three months ended Dec. 31, its first fiscal quarter. That compared with a profit of $27.2 million (83 cents) a year. Quarterly revenue rose to $1.93 billion from $1.5 billion in the year-earlier period.