The energy market has been buoyed by higher oil prices this year. That has helped energy stocks in the S&P 500 to outperform the broader market nearly two-to-one so far in 2018. While the red-hot stocks of oil producing companies have helped drive some of that outperformance, other energy companies have had a good run, too. Here's a look at the five best non-oil-producing energy stocks in the S&P 500 so far this year:

Energy Stock

YTD % Change

Type of Company

HollyFrontier (NYSE:HFC)

33.5%

Refining

ONEOK (NYSE:OKE)

29%

Pipelines

National Oilwell Varco (NYSE:NOV)

18.7%

Equipment

Valero (NYSE:VLO)

18.8%

Refining

Andeavor (NYSE:ANDV)

15.3%

Refining

Returns as of July 2, 2018.

A storage tank with the sun rising in the background.

Image source: Getty Images.

HollyFrontier: The right place at the right time

Typically, refining companies like HollyFrontier struggle in an environment of rising oil prices because it cuts into their margins. This year, however, refiners have benefited from several other catalysts that have more than offset that headwind.

One of them is the fact that the price of oil coming out of Canada and the Permian Basin in West Texas has been much lower than global prices due to pipeline problems. That's enabled HollyFrontier to cash in since its refineries process significant quantities of these crudes. On top of that, the company has been one of the beneficiaries of a shift in U.S. policy on biofuels, easing a cost that had squeezed margins.

ONEOK: Securing the next phase of growth

Pipeline giant ONEOK started the year with a bang by announcing a $1.4 billion pipeline expansion in the Rockies. And that was only the beginning of good things to come for the company. A few weeks later, ONEOK announced another $2.3 billion of expansion projects. Meanwhile, it followed that up with a few smaller project announcements last month. These expansions increase the likelihood that ONEOK can achieve its bold plan to grow its high-yielding dividend at a 9% to 11% annual pace through 2021, putting it in a class of its own among companies in the S&P 500.

National Oilwell Varco: Renewed optimism after a rough start

Oilfield equipment maker National Oilwell Varco stumbled into 2018 after it misread the market and experienced some other delays, which caused its first-quarter results to take a step back and its stock to tumble. But shares have rebounded sharply along with oil prices on the view that oil companies will ramp up their drilling activities and need more equipment in the coming quarters. In addition, National Oilwell Varco started capturing some of the attractive investment opportunities in its sights. It bought a Dutch rig design and engineering company, and formed a joint venture with the national oil company of Saudi Arabia to make drilling equipment. These factors led an analyst from Raymond James to upgrade the stock to outperform on the view that National Oilwell Varco is "uniquely positioned for a multiyear oilfield growth story," and that green shoots in the offshore drilling market could finally turn around the results of its rig technologies segment.

A pipeline heading into a refinery.

Image source: Getty Images.

Valero: Shifting into a higher gear

Fueling Valero's surge has been many of the same catalysts that benefited fellow refiner HollyFrontier. Those factors led Morgan Stanley to upgrade the stock to outperform and raise its price target from $110 to $140 a share (well above the recent price of $108). Boosting that optimism is the view that shifts in oil supplies and regulations will drive strong returns for refiners like Valero. That leads Morgan Stanley to believe that refining is about to enter a "golden age" through 2020, which could enable Valero's investors to earn outsized returns in the coming years.

Andeavor: Joining forces

While renewed optimism in both the oil and refining sectors helped create strong gains for Andeavor this year, the main catalyst was the company's merger agreement with fellow refiner Marathon Petroleum. Marathon offered $35.6 billion in cash and stock for its peer, which implied a 24.4% premium to Andeavor's previous trading price. The transaction will create the country's largest independent refiner when it closes later this year and could generate an estimated $1 billion of cost savings in the future.

Plenty of fuel left in the tank

After an exceptional 2017, oil refinery stocks have continued their torrid run this year, making them some of the best-performing energy stocks in the S&P 500. They appear to have more upside ahead thanks to the expectation that market conditions will continue improving. Likewise, good things seem to be upcoming for companies like ONEOK and National Oilwell Varco. These factors suggest that investors still can make plenty of money on energy stocks in the coming year even after their big run in the first half of 2018.

Matthew DiLallo owns shares of National Oilwell Varco. The Motley Fool owns shares of and recommends National Oilwell Varco. The Motley Fool owns shares of ONEOK. The Motley Fool has a disclosure policy.