Forget Princess Peach. The Mario Bros. need to bail out Nintendo Co. instead.

After a 30-year winning streak, Nintendo took a rare misstep and on Thursday posted more than half a billion dollars in red ink — the gaming company’s first annual loss since it began publicly reporting its financials in 1981.

Nintendo has seen sales of its once-popular Wii game console and DS handheld consoles slip as consumers flocked toward smartphones and tablets for mobile games and toward the more powerful Xbox 360 and PlayStation 3 consoles for playing in the living room.

Nintendo’s annual sales had been declining for the last three years, but Nintendo was able to maintain its profitability until this last fiscal year ended March 31, when it recorded a $534.6-million loss on $8 billion in revenue. The year before, Nintendo had a $960.5-million profit on $12.6 billion in sales.

The maker of Mario and Zelda games in January warned investors that it would likely post a $804.3-million loss on $8.2 billion in sales. While sales came in lower than it had forecast, losses narrowed as a result of a weaker-than-expected yen.

Still, the rapid rise of inexpensive or free smartphone games — such as Angry Birds, for mobile devices such as the iPhone, iPad and Android phones — have weakened Nintendo’s once-dominant grip on the portable games market. In addition, sales of its Wii console have slipped precipitously as players gravitated to the Xbox 360 and the PlayStation 3, both of which have higher graphical capabilities and a more robust online entertainment offering than the Wii.

Nintendo had hoped that its 3DS handheld console, introduced a year ago, would help it regain its footing. But slow sales forced the company to slash the 3DS price from $250 in March to $170 in August, which the company acknowledged Thursday was below its cost to produce the device. Although the price cut helped fuel sales to more than 17.1 million units as of March 31, it also widened Nintendo’s financial losses.

The 123-year-old company, which started in 1889 selling playing cards, is now pinning its hopes on its upcoming Wii U, a next-generation console scheduled for launch in time for the end-of-year holiday sales season. At the same time, Nintendo expects to be selling the 3DS at a profit around September, thanks to declining component costs.

As a result, Nintendo forecast higher revenue of $10.1 billion and a return to profitability at $246.6 million net income for its current fiscal year. The predictions depend on Nintendo being able to increase Wii unit sales 6.7% and 3DS sales 36.7%.

Some analysts are skeptical Nintendo will hit its marks.

“They’re on drugs if they think their hardware sales are going to grow,” said Michael Pachter, an analyst with Wedbush Securities. “The market for their products is shrinking.”

Nintendo has at least one ace in its pocket — its portfolio of games, including the Mario, Zelda, Metroid and other character-based franchises, all of which have a dedicated, if shrinking, fan base.

“Core gamers will stick with Nintendo,” Pachter said. “But that crowd is half what it used to be.”

Meanwhile, Zynga Inc., one of the companies responsible for drawing casual gamers away from Nintendo, posted a 32% uptick in sales for its first quarter ended March 31 to $321 million, higher than analysts had expected.

But the San Francisco social gaming giant, which publishes games like Words With Friends and FarmVille, recorded a net loss of $85.4 million, compared with a $16.8-million gain a year earlier, largely because of stock-based compensation expenses. Without the stock charge, Zynga’s net income was $47 million for the quarter, beating Wall Street’s average estimates of $41.3 million, according to Thomson Financial.

Zynga shares, which gained 31 cents to close at $9.42 Thursday, dropped back 12 cents to $9.30 in after-hours trading following the earnings release. Stock in Zynga, which went public at $10 a share in December, followed by a secondary offering at $12 a share on April 3, has suffered as Wall Street remains skeptical of the company’s ability to keep up its growth and dilute its reliance Facebook, where it gets the bulk of its players.

The company has announced initiatives to grow its mobile games business as well as drive traffic to its online platform, Zynga.com, but those efforts are still in their early stages.

alex.pham@latimes.com