By Sebastian Pellejero

Oil prices rose Thursday after employment data showed the U.S. economy gained more jobs than expected last month.

U.S. crude futures for August delivery added 2.1% to $40.65 a barrel on the New York Mercantile Exchange, putting them on target for their highest closing price since March 6.

Prices edged higher after Labor Department data showed the U.S. added 4.8 million jobs in June, bringing the unemployment rate down to 11.1%. That increase was larger than economists surveyed by The Wall Street Journal expected.

Oil investors said Thursday's strong employment report was a sign that the U.S. economy is recovering from the pandemic, despite a recent climb in cases. Recent data has indicated that the recovery could be slowing down, a concerning development for those betting on surging demand for crude.

Recovering demand and record production cuts by the Organization of the Petroleum Exporting Countries and its allies have helped return prices to their March levels. Still, stockpiles remain elevated after surging during the spring, and analysts are skeptical that demand will return to its prepandemic levels, especially as cases in big states like Texas, Florida and California continue to rise.

In the U.S., crude stockpiles have started to come down. On Wednesday, weekly U.S. data showed crude inventories had fallen by 7.2 million barrels last week, a much bigger drop than the 100,000-barrel decline traders and analysts surveyed by The Wall Street Journal expected.

Analysts at Goldman Sachs said that oil demand could reach precoronavirus levels by 2022, driven by growth in emerging economies, relatively low energy prices and rising sales of petrochemicals. Others, however, are less optimistic.

"Future [oil] demand growth could be weaker than before [the coronavirus]," due to less flying and more working from home, said Citigroup analysts in a note.

Meanwhile the number of rigs drilling for oil, a proxy for sector activity, declined in June. Oil rigs in operation world-wide fell by 103 last month to 1,073, according to data released Thursday by Baker Hughes. In the U.S., the oil-rig count was down 72 in June to 274.

Brent crude futures for September delivery, the global gauge of oil prices, jumped 2.6% to $43.14 a barrel on the Intercontinental Exchange Thursday.

Elsewhere in commodities, most actively traded gold futures recovered some of Wednesday's losses, rising 0.6% to $1,790. Earlier in the week, gold futures breached $1,800, the highest level in almost nine years, as investors flock to the haven metal amid economic uncertainty and low interest rates on government bonds.

Write to Sebastian Pellejero at sebastian.pellejero@wsj.com