The the first quarter of 2017 was not kind to the S&P 500 Index's energy sector as U.S. producers increased production even though it kept prices down, as they fought to keep pace with OPEC production cuts.

While it is always hard to pin down OPEC production with clarity, industry experts acknowledge that the cartel's November 2016 announce production cuts seem to be reducing their crude on the market, but U.S. drillers operating in the Permian Basin are raising production at the same time.

The supply build and price drop that result from increased U.S. production has a downside, though. If prices fall too much, banks that lend to U.S. and other drillers my ease back on their lending to drillers, which would slow their production.

Last Friday Baker Hughes (BHI)  weekly data reported a net of 20 oil and gas rigs came online in U.S. shale basins over the past week,  bringing the Houston oilfield services' overall tally to 809 rigs. All told, the U.S. count is now up 345 rigs from this time last year when the count stood at 464, Baker Hughes said, with oil rigs up 280 and gas rigs up 63.

West Texas' Permian Basin is where the rush for black gold is focused.

As all that played out across the sector, only three of the S&P 500's energy stocks managed to post a gain in the first quarter.

National Oilwell Varco(NOV) - Get Report led the winners with 7% gain. 

Investors were encouraged in February when the oilfield equipment and services company reported a narrower-than-anticipated loss of 15 cents a share in the fourth quarter on revenue of $1.69 billion.

A consensus of analysts surveyed by FactSet was calling for a loss of 29 cents a share on revenue of $1.63 billion.

Still, analysts polled by FactSet anticipate a first-quarter loss of 22 cents a share for NOV on flat quarter-over-quarter revenue of $1.68 billion.

Overall, National Oilwell Varco should lose less money in 2017, but analysts do not expect the company to return to profitability until 2018 as much of the oilfield services industry works to regain pricing ground given up during this two-year commodity downturn.

Kinder Morgan  (KMI) - Get Report, one of the nation's largest pipeline company, finished the quarter with the sector's second best performance, rising 3.5% in the year's first three months.

That's notable because it made news during the period when famed investor and Berkshire Hathaway CEO Warren Buffett revealed that he had dumped his stake in the Houston firm. Add in a regulatory probe under way and lower-than-expected revenues in eight of the last ten quarters and one might not expect top performance.

But as Shubhankar Adhikari wrote for The Street earlier this year, "not all is lost."

The company has begun talks to raise capital for its ambitious Trans Mountain project. Besides, the low expectations for the stock are setting it up for double-digit growth even if you exclude the 2.35% dividend yield.

And, Buffett may have exited Kinder Morgan, but hedge fund titan David Tepper has increased his KMI bet. Tepper's Appaloosa Fund has grown its position significantly in Kinder Morgan, and this is a sign of the company's value. Tepper is famous for buying distressed stocks that have substantial turnaround potential.

Tepper is not alone in expecting good results from Kinder Morgan. Credit Suisse(CS) - Get Report analysts also think the company's 2017 prospects will be better when they upgraded the company to 'outperform' back in October.

Exploration and production firm Pioneer Natural Resources(PXD) - Get Report rounds out the energy sector's trio of winners, having posted a 1.3% quarterly gain.

Earlier this month the company signed a purchase and sale agreement with an undisclosed buyer to sell its acreage in northeastern Martin County, Texas, for $266 million. The sites current net production is approximately 1,500 barrels oil equivalent per day.

The northeastern Martin County acreage sale, when combined with previously-announced acreage sales in Upton and Andrews counties and ongoing property trades, continues to advance the high-grading of Pioneer's premier position in the Midland Basin.

The deal is expected to close by the end of April 2017.

And Bruce Kamich, a technical analyst for the Street's Real Money subscription service said in January to watch for a breakout in the shares.

"We can see that prices have been in roughly a $170 to $195 trading range for the past five months. Prices have crossed above and below the neutral, 50-day moving average line. The longer-term, 200-day moving average line has had a positive slope since April, and is still pointed up," Kamich wrote earlier this year. 

"While our go-to indicators are stuck in neutral, we would not fight a close above $195 as a breakout on the upside. A close below $170 would turn the chart bearish," he concluded. 

Pioneer shares closed at $182.81 on Thursday.