Spain's second-largest oil company Cepsa said on Thursday its third quarter net profit rose 50% thanks to soaring oil and refined product prices.

"Cepsa's three main businesses had a strong performance during the third quarter of the year, on the back of a supportive market environment with higher crude prices and enhanced refining margins, above the historical average," said the company, which is in the process of transitioning to green energies but still depends heavily on the oil and gas business.

Net profit in the quarter rose to 107 million euros ($116.15 million) from 71 million euros in the same period in 2022.

The company had booked a net loss in the second quarter when the price of oil and gas fell and refining margins narrowed.

($1 = 0.9212 euros) (Reporting by Tomas Cobos, editing by Inti Landauro and Elaine Hardcastle)