What happened

Shares of Trex Company (NYSE:TREX) surged on July 30, following the company's second-quarter earnings release and conference call after trading hours on July 29. Shares opened up more than 10%, and steadily marched higher all morning before briefly touching a 20% gain around 1 p.m. EDT.

So what

Trex reported sales of $206 million and adjusted earnings of $0.64 per share, both of which came in relatively close to analyst expectations. While Wall Street analyst estimates aren't a reliable guide to a company's results, they often play a big role in how investors react to a company's results.

Trex decking on display in a home improvement store

Image source: Trex.

In today's case -- earnings relatively in line with estimates -- a 20% jump doesn't exactly jibe. But there's a clear explanation for today's exuberant reaction to Trex's results: very high expectations for Trex to return to big growth in the third quarter after stumbling out of the gate in the first quarter.

In the earnings release, Trex management said they expect the company to generate sales of $205 million to $210 million in the third quarter. At the midpoint, that would result in 25% growth versus last year's Q3: a clear signal that demand for Trex decking indeed remains strong, and the company's recent investments in expanding its manufacturing capacity will pay off.

Now what

Trex's investments in growth aren't just to meet pent-up demand from recent quarters. On the earnings call, CEO Jim Cline described the company's ongoing long-term plan for expanding manufacturing capacity, pointing out that it would increase total capacity by 70% once completed in 2021.

Trex's operating results also improved from the first quarter to the second. Adjusting for start-up costs and added material costs related to capacity expansion, gross margin was 44.1%, a nice bounce-back result that's in line with the expectations management set after the first quarter.

Before today's surge, Trex shares were still down about 11% since the Q1 earnings release, and short-sellers had more than doubled their bets against the company, pushing the percentage of shares sold short above 15% in recent weeks. With today's earnings release indicating that the growth story is set to resume, and Trex's operating results once again delivering as expected, you have a bit of a perfect storm for a double-digit gain.

For long-term investors, today's jump is nice, but it's better to focus on how the company executes on its expansion plans in the next couple of years. With history as a guide, I wouldn't want to bet against this company or its management team.

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.