Microsoft Corp. (Nasdaq: MSFT), the world's biggest software company, and Barnes & Noble Inc. (NYSE: BKS), said they've agreed to collaborate on new tablet technology to battle Apple Inc. (Nasdaq: AAPL), the world's most valuable technology company, and Amazon.com Inc. (Nasdaq: AMZN).

Barnes & Noble, developer of the Nook e-reader, will spin it off into a new division with a $300 million cash infusion from Microsoft, based in Redmond, Wash.,will also provide a Windows 8 application for the Nook. The new unit will have an initial market value around $1.7 billion, the partners said, which is more than twice that of Barnes & Noble's capitalization before the announcement.

In turn, New York-based Barnes & Noble, the struggling national bookstore chain, with 691 bookstores and 641 college stores, will have a long-term relationship with Microsoft.

The move sent Barnes & Noble shares up nearly 100 percent in pre-market trading, to $26.45, up $12.75. They closed at $20.75, up $7.07 or 52 percent, valuing the whole company at $1.25 billion. Microsoft shares rose 3 cents to $32.01. They've gained 23 percent so far this year.

The tie-up essentially transforms Barnes & Noble from a brick-and-mortar retailer into a digital one, backed by Microsoft's reach and technology.

Both now will be better able to battle Apple, which has sold more than 66 million iPads in about two years, as well as Amazon, which has sold an estimated 9 million Kindles Fires and older-model Kindles.

For B&N's point of view, this is an easy decision, said N. Venkat Venkatraman, chairman of Information Systems Management Department at Boston University School of Managament. From Microsoft's point of view, this is not a bad decision as long as Nook has staying power.

The new unit hasn't been named yet. Barnes & Noble CEO William Lynch hailed the deal as an important part of the retailer's strategy. Microsoft President Andy Lees said the shift to digital is putting the world's libraries and newsstands in the palm of every person's hand.

The companies also said they dropped patent lawsuits against each other.