Based solely on how the market has treated its stock over the past couple of days, you'd think Trex Company Inc (TREX -0.93%) reported terrible first-quarter earnings. Trex's share price has fallen nearly 13% since the company released its earnings after market close on May 4.

Here's the thing: Trex reported that revenue increased 10% and earnings per share were up 20%, as the company continues to take market share from its competitors and from traditional wood decking. Both metrics were solid and came in above market estimates. So what gives?

Friends gather for a cookout on a deck.

Deck building season is upon us, and Trex is taking market share. Image source: Getty Images.

In short, it's a reminder that the market can be unpredictable in the short term, even when a business seems to be doing everything right. Let's take a closer look at what's most important for investors: how the company's business is performing and what we can expect going forward. 

Trex's marketing and operating strategies continue to pay off

Over the past couple of years, Trex's management has focused on three key priorities for driving better results: expanded marketing, new product development, and rigorous improvement to operations. 

From an operations perspective, Trex made more solid gains in the first quarter, with gross margin up 120 basis points to 45%. The majority of this improvement is the result of efforts to drive down fixed expenses, to improve throughput from existing lines, and to reduce material costs. The table below shows how the company has been able to steadily drive its quarterly gross margins higher:

TREX Gross Profit Margin (Quarterly) Chart

TREX Gross Profit Margin (Quarterly) data by YCharts.

Even with the impact of seasonal demand for its products, the company has been able to improve gross margin on a year-over-year basis each quarter for the past couple of years. A significant amount of this margin improvement has reached the bottom line. This has happened in no small part because the company has been able to keep its sales, general, and administrative expenses (SG&A) as a percentage of sales in line while it improved gross margin. 

However, SG&A increased in the quarter, from 15.7% to 16.1% of sales year over year. Management said that this was a planned increase and was directly related to the company's marketing and product development strategy. Of the $2.7 million increase in SG&A, $2 million of that was related to higher sales and marketing ($1.2 million) and R&D ($0.8 million) spending in the quarter. 

With net income and operating income both well above last year's quarterly results, this afforded Trex the ability to spend slightly more on marketing and R&D while still growing earnings per share by 20%. 

Looking ahead

CFO Bryan Fairbanks said management expects the company to generate $160 million in sales, or roughly 10% sales growth in the second quarter, with incremental margin from those new sales of more than 50%. He also said that the company expects SG&A to be roughly the same as a percentage of revenue as it was in the year-ago quarter. If that all proves to be the case, the company is likely to deliver another quarter of top- and bottom-line growth similar to this one. 

The bottom line is that Trex continues to absolutely nail it, with fantastic operating results that wring a lot of incremental profits out of sales growth, and management doesn't see the growth coming to a stop now. 

Trex's effective marketing across both traditional and social media is paying off with by far the best brand recognition in the industry. That's leading to faster sales growth than alt-wood competitors and the overall decking market. Trex's broad North American (and growing international) distribution network also continues to help offset the impacts of regional weather events, which have weighed on its quarterly results in the past. Factor in a relatively healthy economy and housing market, and a jobs market that is showing gains in both employment levels and income, and there's a lot to like about Trex's near-term and long-term prospects.