2012 is nearing its end, and now's a good opportunity to look at what happened throughout the year to the stocks you follow. If you know the important things that a company achieved, as well as any challenges it failed to overcome, then you can make a better decision about whether it really deserves a spot in your portfolio.

Today, I'll look at Terra Nitrogen (NYSE: TNH). The fertilizer company saw some impressive gains in the first few months of the year, but the stock fell back for the rest of 2012 as some big problems hit the entire agricultural sector fairly hard. Below, you'll find more to explain what happened with shares of Terra Nitrogen this year.

Stats on Terra Nitrogen

Year-to-date stock return

36.9%

Market cap

$3.98 billion

Revenue, past 12 months

$775 million

Net income, past 12 months

$307 million

1-year revenue growth

4.6%

1-year net income growth

16.1%

Dividend yield

7.8%

CAPS rating

*****

Source: S&P Capital IQ.

How did Terra Nitrogen grow so fast in 2012?
Terra Nitrogen enjoyed several sets of favorable conditions over the past year. During the early part of 2012, the exceedingly warm winter allowed farmers to get an early start to their planting season, boosting use of fertilizer and sending Terra's shares on a huge run. Demand from emerging markets was also strong, adding to sales.

Another huge competitive advantage that Terra and peer Rentech Nitrogen Partners (NYSE: RNF) enjoyed was the low price of natural gas, which is an input to the nitrogen fertilizer manufacturing process. With gas hitting all-decade lows earlier this year, low input costs went straight to Terra's bottom line. Meanwhile, fertilizer rivals PotashCorp (POT) and Mosaic (MOS 0.26%), both of which rely on mined potash to produce their fertilizer products, saw big losses in their shares as mining costs rose and pricing became noncompetitive.

Along with big share price gains, Terra investors continued to benefit from its master limited partnership structure, which helped produce impressive distribution yields again this year. That stands in contrast to Terra's majority owner, CF Industries (CF 0.90%), which pays less than a 1% yield.

Terra has plenty of potential to keep growing alongside demand for food around the world. As long as natural gas prices remain restrained, Terra will have the wind at its back.

Click here to add Terra Nitrogen to My Watchlist, which can find all of our Foolish analysis on it and all your other stocks.