Chevron Corp. turned around a year-ago loss during the second quarter, while production increased and operating costs fell.

The supermajor on Friday reported it earned $1.5 billion (77 cents/share) during 2Q2017, compared with a year-ago loss of $1.5 million (minus 78 cents). Revenue increased to $33 billion from $28 billion.

Meanwhile, operating expenses have fallen 10% and capital expenditures (capex) — nearly 90% weighted to the upstream — were down by 25% through the first six months from a year ago.

“Second quarter results improved substantially from a year ago and year-to-date net cash flow is positive,” said CEO John Watson. “We’re delivering higher production with lower capital and operating expenditures.”

Upstream earnings overall increased to $853 million, reversing a year-ago loss of $2.46 billion. Like ExxonMobil Corp., which also reported results on Friday, Chevron’s U.S. upstream business performed better than a year ago. However, the domestic unit, also like ExxonMobil, remained in the red, with a loss of $102 million in 2Q2017 versus a year-ago loss of $1.11 billion.

Chevron’s average sales price for crude oil and natural gas liquids was $41/bbl, up from $36 a year earlier. The average sales price of natural gas was $2.32/Mcf, versus $1.21 a year ago.

Worldwide net production was 2.78 million boe/d in 2Q2017 from year-ago output of 2.53 million boe/d. Net boe output was 701,000 boe/d in 2Q2017, 19,000 boe/d higher year/year. Net liquids output increased 6% to 530,000 b/d net, while natural gas production decreased 6% to 1.03 Bcf net, primarily the result of 2016 asset sales.

Gas production was boosted by the joint venture Gorgon liquefied natural gas (LNG) export project in Australia, which is “running above nameplate capacity,” Watson said. First production from Wheatstone LNG, also in Australia, is expected in August.

Chevron also recorded record quarterly output from shale and tight resources within the stalwart Permian Basin, where the operator is directing most of its U.S. onshore fortune. And it showed stronger output from the Gulf of Mexico deepwater, where production climbed from the Jack/St. Malo project.