The oil and gas industry has seen its ups and downs over the past several years, and that volatility has been a thorn in the side of MasTec (MTZ 3.26%). With many of its construction projects dealing with energy applications, MasTec has had to weather rapidly changing conditions in the energy sector, and many times, those swings have whipsawed investors in the company.

Coming into Thursday's third-quarter financial report, MasTec investors had high hopes that the company would finally start getting things moving in the right direction. Thanks to a favorable resolution on a large pipeline project, MasTec's results were even better than many had expected, and the company now seems to be ready to plow ahead toward a better 2019.

Person in welding gear welding two parts of a pipeline together, with dirt piles behind.

Image source: Getty Images.

Here's what MasTec achieved during the quarter

MasTec's third-quarter results helped the company regain some of its lost momentum. Revenue picked up 1% to $1.98 billion and was only slightly less than the $1.99 billion that most of those following the stock were looking to see. Adjusted net income jumped 55% to $105.2 million, though, and the resulting adjusted earnings of $1.33 per share topped the consensus forecast among investors by $0.08 per share.

It was easy to see the impact that the oil and gas segment had on MasTec's overall results. From a sales perspective, the energy sector still weighed on growth, with segment revenue falling almost 11% from year-earlier levels. However, that was a far gentler rate of descent than the company has seen in recent quarters, and even more encouraging was the fact that the segment enjoyed a 44% jump in adjusted pre-tax operating profit.

Other segments of MasTec's business pulled their own weight. Communications posted an 8% rise in segment revenue that boosted profit by 14%, while the electrical transmission business saw a 21% gain in sales but suffered a slight profit decline. In power generation and industrial, MasTec saw revenue jump more than 80%, while profit levels eased higher slightly.

A couple of things stood out to define MasTec's success. First, backlog jumped to a record $7.8 billion, up 56% from the third quarter of 2017. Second, MasTec said that it successfully resolved a contractual issue with a recently completed long-haul oil and gas pipeline project. The resulting cash inflow arrived after the beginning of the current quarter, but since the third quarter ended, MasTec says it's gotten more than $700 million from this and other oil and gas projects.

CEO Jose Mas explained just how hard it was to succeed during the period. "We had a great quarter," Mas said, "despite regulatory and hurricane flooding disruptions on selected projects." The CEO pointed to record results as encouraging for MasTec's immediate future.

What's next for MasTec?

MasTec has plenty of things to be excited about. In Mas's words, "Our record backlog level across multiple segments continues to give us strong visibility for continued growth in 2019 and beyond." In addition, the big bump-up in cash flow has helped improve its balance sheet, reducing leverage considerably and giving MasTec far more liquidity to deal with ongoing operating capital needs. CFO George Pita estimates that net debt levels could fall from $1.7 billion currently to as little as $1.1 billion to $1.2 billion by year-end.

Based on better conditions, MasTec boosted its guidance. Adjusted earnings of $3.76 per share would be $0.09 higher than the company previously anticipated, and MasTec believes it will be able to bring in about $6.9 billion in sales for 2018. For the fourth quarter in particular, revenue of $1.9 billion will come largely from big oil and gas projects, and adjusted earnings of $1.05 per share would be stronger than most investors were expecting.

MasTec shareholders were quite happy with the performance, and the stock climbed 7.5% in after-hours trading following the announcement. With oil and gas starting to look more favorable, MasTec could finally have the tailwinds it needs to make the most of its growth opportunities.