The energy sector was one of the bright spots in this week’s dismal market performance. So far, the S&P 500 energy sector is up more than 5% for the week, becoming the only positive for the week. Meanwhile, the broad-based index fell on Friday after Federal Reserve Chairman Jerome Powell said the central bank will continue to raise interest rates to combat inflation and warned of “more pain ahead.” The S&P 500 is on track to drop 2.8% this week. Higher oil prices have helped drive inventories higher. West Texas Intermediate crude is up 1.7% this week. According to Jerry Castellini, president of CastleArk Management, energy stocks are also a good way to protect your portfolio from inflation. They “will be the most profitable in case inflation continues, but also give you some downside protection,” he said in a CNBC interview on CNBC’s “Power Lunch” on Thursday. value in case there is a market that really craves yields”. Here are the energy companies that performed better this week, and the analysts’ positions on the stock. To find these names, CNBC Pro scoured the stocks in the space with the best performer of the week to date. APA Corp is the biggest winner in the field, up nearly 11% for the week so far. It still has another 33% gain, according to the average analyst price target. Only 44% of analysts give stock buy rates. Marathon Oil follows, seeing a 6.8% gain in its stock so far this week. Based on the average average price target, it still has a 23.3% gain. About 46.2% of analysts on the stock believe it was a buy. Analyst favorite Baker Hughes is up 3.4% so far this week and up another 35.7%, according to analyst median price targets. Most analysts covering the stock, 72%, rate it as a buy. Earlier this week, Stifel analysts said they view carbon capture technology incentives from the Inflation Reduction Act as positive for Baker Hughes, the company developing the technology. Devon Energy and Diamondback Energy also have more than 70% of analysts rating the stock as buy. Devon Energy is up 6.7% this week, while Diamondback is up 3%. Earlier this month, Devon Energy earnings beat expectations. The company reported total revenue of $5.63 billion for the fiscal second quarter versus expectations of $4.21 billion. Pioneer Natural Resources is up 6.2% for the week and up another 11.4%, according to the average analyst price target. Half of all stock analysts consider the stock a buy. The company’s CEO recently told CNBC’s Jim Cramer that the oil company plans to continue returning most of its cash flow to shareholders. “The growth period for the industry is over,” he said. — Michael Bloom of CNBC contributed to this report.