Nov 20 (Reuters) - U.S. energy firms cut the number of oil and natural gas rigs operating for the first time in 10 weeks even as producers return to the wellpad with crude prices mostly trading over $40 a barrel since mid June.

The U.S. oil and gas rig count, an indicator of future output, fell by two to 310 in the week to Nov. 20, according to Friday data from energy services firm Baker Hughes Co.

Even though the overall count declined, the number of operating rigs has surged since August, when it hit a record low of 244, according to Baker Hughes data going back to 1940.

U.S. oil rigs fell five to 231 this week, after rising last week to their highest since May, while gas rigs gained three to 76, their highest since July, according to Baker Hughes data.

The U.S. oil industry has been hit hard by the coronavirus pandemic, knocking fuel demand down by roughly 12% this year. Operators seeking to conserve costs cut drilling operations, but have lately added rigs to take advantage of lower costs for drilling crews.

"Following the dramatic shutdown of the U.S. oilfield during the second quarter, the rig count is slowly rising as (exploration and production companies) become more comfortable with the (price) environment and seek to stabilize production," James West, senior managing director at Evercore ISI.

U.S. shale production peaked in November 2019 at 9.2 million barrels per day, but was expected to fall to 7.5 million bpd by December, according to U.S. Energy Department figures.

U.S. crude traded around $42 a barrel this week on hopes of an effective coronavirus vaccine. Oil futures are up about 121% over the past seven months on expectations global economies will recover in coming months. (Reporting by Scott DiSavino Editing by Marguerita Choy and Sonya Hepinstall)