Alcoa Inc, the largest aluminum producer in the U.S., posted a fourth-quarter profit on Tuesday, in line with Wall Street expectations, and handily beat expectations on revenue, helping calm investors' nerves after a rocky 2012.

For the fourth quarter, the company reported net income of $242 million, or 21 cents per share, compared with a net loss of $191 million, or 18 cents per share, in the year-ago period, Reuters reported.

Excluding one-time items, net income was $64 million, or 6 cents per share, in line with average analysts' expectations of 6 cents per share on revenue of $5.6 billion, according to Thomson Reuters I/B/E/S.

Sales were $5.89 billion, beating analysts' expectations, but down 1.5 percent from the year-ago quarter as the average realized price per ton of aluminum fell slightly.

Alcoa trimmed costs by 12 percent in the fourth quarter, due in part to fewer restructuring expenses.

"I'm more optimistic that 2013 is a year with upside potential compared to where we came from," Alcoa Chief Executive Klaus Kleinfeld told CNBC on Tuesday.

Shares of Alcoa rose 1.3 percent in after-hours trading, as investors were buoyed by Alcoa's turn to profit.

Analysts breathed a sigh of relief from the results of the first S&P 500 company to report fourth-quarter results, hoping it was a sign of things to come.

Investors tend to scrutinize Alcoa's results for hints on where the overall economy is headed, as the company's aluminum products are used in the automotive, appliance and airline industries.

The company said it expects global aluminum consumption growth of 7 percent in 2013, up slightly from 6 percent in 2012. Alcoa continues to forecast a doubling of global aluminum demand between 2010 and 2020.