MasTec nailed it in the second quarter, and expects to keep swinging the hammer all year. Image source: Getty Images.

What: Shares of MasTec, Inc. (NYSE:MTZ) are up 16.95% at 1:20 p.m. EDT on Aug. 5, following the infrastructure-construction company's second-quarter earnings report, released after the market close on Aug. 4.

So what: MasTec reported $1.23 billion in revenue in the second quarter, up 15% from last year, and $24.4 million net income, good for $0.30 per share, after reporting a loss of $3.8 million one year ago. Adjusted for one-time and non-recurring costs, MasTec's earnings were $29.9 million, up 370% from $8.1 million. 

The company also reported a huge 31% increase in its 18-month backlog, which is now at $5.3 billion. CEO Jose Mas pointed to growth in the oil-and-gas and communications sectors as driving the company's quarterly growth, as well as its backlog. 

Now what: On the back of a strong quarter and growth in its backlog, MasTec management raised guidance for the full year, and is now expecting $5 billion in revenue and $112 million in net income, or $1.36 per share. The company's guidance for the third quarter is $1.5 billion in revenue and $52 million net income, or $0.64 per share. 

MasTec is beginning to emerge from what has been a tough past couple of years, as the oil and gas downturn weighed heavily on capital investment in infrastructure for the industry. However, it's looking like the commodities cycle is starting to turn in this company's favor. The company will likely always be subject to cyclical demand tied to the industries it serves, so a recovery in one of its most important ones -- the energy industry -- even with oil and gas prices still well down could be a good sign for long-term investors. Based on MasTec's raised guidance and strong backlog growth, near-term prospects are certainly looking good. 

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.