Sell Nokia on Microsoft deal, says Jim Cramer

CNBC's Jim Cramer said Tuesday that investors who took his advice earlier this summer and bought Nokia stock should now sell it.

"I want people to sell Nokia because I've been recommending Nokia as a spec," Cramer told "Squawk on the Street," after Microsoft's $7.2 billion deal to buy Nokia's mobile phone business. "I just think you ring the register."

Shares of Nokia soared on news of the Microsoft deal, which takes the companies' 2½-year partnership to a new level. Nokia already runs Microsoft software on its smartphones, which significantly lag the market leaders, Samsung and Apple.

For his part, Microsoft CEO Steve Ballmer, who is retiring, told CNBC, "What's good for Windows phone will be good for the overall Windows ecosystem."

(Read more: Ballmer: Nokia deal opens possibilities for tablets)

Cramer countered, asking: "Steve Ballmer, what did you get here? Steve likes that phone. I saw him use it at my college reunion. [But] I wouldn't have bought the whole company because I like the phone."

"It's tough enough for Apple to beat Samsung," Cramer added—he does not see how a combined Microsoft and Nokia could do it. "I think that Microsoft is struggling for relevance."

Nokia CEO Stephen Elop will come back to Microsoft as part of the deal. "It's a very expensive successor, if that's what this is all about," said Cramer.

(Read more: Is Elop being groomed to take over top job at Microsoft?)

Three years ago, Elop left the Redmond, Wash.-based company for the Finnish handset maker. When the deal closes, he'll lead the devices group at Microsoft, and there's speculation that he may be favored to become the next CEO of the software giant when Ballmer leaves next year.

"Microsoft needed to do something. It was flailing," Cramer said. "What it decided to do is let Samsung and Apple have the whole game."

He also joked that for Microsoft, the deal is like burning money. "They can do two things, shove the money into a giant furnace or they can go buy this."

By CNBC's Matthew J. Belvedere. Follow him on Twitter @Matt_SquawkCNBC.