Investors have waited to see whether anticipated increases in infrastructure spending would lift stocks of companies in the construction industry. Yet MasTec (MTZ -2.17%) decided not to wait for Washington to act, and instead, it has strived to find ways to create its own growth opportunities.

Coming into Thursday's second-quarter financial report, MasTec investors had high hopes for solid gains in revenue and earnings. Yet even MasTec itself seemed surprised by just how well it did during the second quarter. Let's take a closer look at MasTec and what its latest results say about the company and its industry going forward.

MasTec pipeline construction project.

Image source: MasTec.

MasTec builds a strong foundation

MasTec's second-quarter results were incredibly strong. Revenue soared by 53% to $1.89 billion, easily beating the company's own guidance for roughly $1.5 billion in sales for the period. Adjusted net income nearly tripled from year-ago levels to $86.7 million, and that resulted in adjusted earnings of $1.03 per share. That made the consensus forecast for $0.65 per share in earnings look embarrassingly small by comparison.

Taking a closer look at MasTec's results, just about all of the outperformance for the company came once again from the oil and gas industry's more favorable conditions. Revenue from the segment was up by $715 million, which was actually greater than the total gain in sales for the company as a whole. Profit from oil and gas was also strong, posting a nearly $100 million gain.

Other sectors mostly treaded water. The communications segment had flat revenue and saw adjusted pre-tax profit fall by more than 10%. The electrical transmission division managed to pick up a 1% rise in revenue, and it turned around a year-earlier loss with a modest pre-tax operating profit. However, the power generation and industrial segment suffered a nearly 50% drop in revenue, and segment profit eased lower slightly.

CEO Jose Mas was happy about how things went. "Our second quarter performance significantly exceeded our expectations primarily due to record levels of oil and gas project activity," Mas said, "with segment revenues at $1.1 billion, a 168% increase over last year's second quarter level."

Can MasTec keep climbing?

MasTec also thinks it will be able to sustain its recent strength. In Mas's words, "Our current performance, coupled with significant opportunities for future growth across all of our segments, position us well for continued long-term growth."

To move forward more aggressively in the energy sector, the company announced that it had made an acquisition of a specialty pipeline equipment leasing company. MasTec thinks that by doing so, it should be able to cut its overall equipment costs and gain a competitive advantage over its peers. At the same time, MasTec also acquired a provider of infrastructure in the areas of civil engineering, water, sewer, and draining systems, and entering that market should give the company what Mas termed "an exciting platform to benefit from increased demand trends in this market."

MasTec once again raised its full-year guidance in response to favorable conditions. The company now believes that it will see sales for 2017 come in at $6 billion, $300 million higher than its previous guidance estimate. Adjusted earnings of $2.73 per share would be 44% higher than 2016 figures and adds $0.28 per share to MasTec's earlier guidance. For the third quarter, MasTec expects revenue of $1.65 billion and adjusted earnings of $0.73, and both numbers are just a bit higher than the current consensus among those following the company's stock.

MasTec shareholders were happy with the news, and the stock jumped more than 7% in after-hours trading following the announcement. If the energy market can keep making progress from its recent downturn, then MasTec could be in an even better position to benefit and keep its upward momentum going throughout 2017 and beyond.