Warren Buffett made the biggest bet of his career, agreeing to buy Burlington Northern Santa Fe Corp. in a $26.3 billion deal that reflects his long-term optimism about the U.S. economy.

The deal for the nation's largest railroad operator by revenue will speed the transition of Mr. Buffett's Berkshire Hathaway Corp. into a megaoperator of industrial firms, moving the Omaha, Neb., conglomerate further from its roots as a nimble investment outfit.

Berkshire...