Chevron Corp.'s (CVX) second-quarter profit climbed 24 percent to surpass analyst estimates as the nation's second largest oil company cashed in on higher gasoline prices.

The San Ramon-based company said Friday that it earned $5.38 billion, or $2.52 per share, during the three months ended June 30. That compared with net income of $4.35 billion, or $1.97 per share, a year earlier.

The results easily topped the average earnings estimate of $2.30 per share among analysts polled by Thomson Financial.

Revenue rose 5 percent to $56.1 billion, also beating the average analyst projection of $50.4 billion.

Like its industry peers, Chevron benefited from higher margins from the refining and marketing operations that funneled fuel to gasoline pumps. The oil industry's gains pinched the pocketbooks of motorists, who have been paying more than $3 per gallon for gasoline in many parts of the country.

Chevron earned $1.3 billion from its refining and marketing operations in the second quarter, a 30 percent improvement from $998 million last year.

That helped the company offset a 1 percent decline in its crude oil production, which averaged 2.63 million barrels per day during the quarter.

"We continued to make progress during the quarter in executing our key strategies," Chevron Chairman David O'Reilly said.