NEW YORK ( TheStreet) -- While visiting Wal-Mart's ( WMT) Web site in search of an obscure book, I could not find it in stock nor could I order it. Instead, I was referred electronically to an unexpected source: Barnesandnoble.com.

Taking heed of the ancient proverb, "the enemy of my enemy is my friend," Wal-Mart has evidently struck up a curious yet most sensible pact with Barnes & Noble ( BKS), which runs an expansive chain of physical, rather than virtual, stores.

An alliance between the two brick-and-mortar titans certainly makes sense for a variety of reasons. First, Wal-Mart and Barnes & Noble.com share the fear of having Amazon.com ( AMZN) siphon off an ever-greater portion of their sales.

Nearly 45% of Amazon.com's sales come from electronics and general merchandise, rather than books and CDs. This percentage has been creeping up in the last two years and will continue to rise as a result of organic growth and Amazon.com's impending acquisition of Zappos.com, an online apparel retailer.

Second, Wal-Mart and Barnes & Noble are trying to jump-start their Web sales, even as they manage increasingly complex chains of physical stores. Both Barnes & Noble and Wal-Mart are experimenting with new techniques to drive Web-browsers into their stores, and vice versa.

For example, merchandise ordered online at Walmart.com can be picked up in or returned to one of its retail stores. This saves the consumer shipping costs and brings more traffic to the store. In an effort to reinvigorate its holiday traffic, Barnes & Noble recently entered the e-book reader fray with the Nook, an electronic book reader that came out this month. The Nook is replete with numerous features and gimmicks to lure book and CD buyers into Barnes & Noble stores.

If you liked this article you might like

Cramer: Dominoes Are in Play Today

Walmart Upping Current Worker Hours Instead of Hiring for the Holidays

Cramer: How to Avoid Being Amazon Roadkill

Walmart to Expand Food Stamp Acceptance Online