(Reuters) - Marathon Petroleum Corp MPC.N agreed to buy rival Andeavor ANDV.N for more than $23 billion (16.7 billion pounds) in a deal creating one of the largest global refiners that will benefit from access to booming U.S. shale fields and growing U.S. fuel export markets.

The United States has become the world’s top fuel exporter, shipping more than 3 million barrels per day (bpd) of gasoline and diesel. Refiners have capitalized on booming output from shale fields in Texas and North Dakota and are building out export terminals and processing facilities.

Buying Andeavor gives Marathon more exposure to the booming U.S. shale oil sector, thanks to Andeavor’s logistics and terminal operations in Texas and North Dakota shale regions. Rising output from the Permian Basin, the largest oilfield in the United States, has driven the nation’s crude production to an all-time record above 10.5 million bpd.

“The combination of the two companies allows us to go after and find ways to create a bigger presence in the Permian,” said Marathon Chief Executive Gary Heminger, who will lead the combined companies.

The company would be able to process 3.1 million bpd of crude oil into gasoline, diesel and other fuels. Its capacity would be the sixth largest globally, behind China's Sinopec 600028.SS, Exxon Mobil Corp XOM.N, PetroChina, Royal Dutch Shell RDSa.L and Aramco, according to consultancy IHSMarkit.

U.S. motorists consume more fuel than any other country in the world and overall demand nationwide hit a record 9.3 million bpd in 2017.

Operations that have capacity to refine light crude produced in shale fields such as Andeavor will be better positioned to take advantage of the production boom. Both North Dakota’s Bakken and Texas shale regions primarily produce light, sweet crude oil.

The deal also gives Marathon a line into fast-growing Mexican fuel markets. Andeavor is expanding its network of filling stations in the country. Mexico’s dilapidated refineries cannot meet the growing population’s demand for gasoline and other products.

U.S. fuel exports to Mexico rose to 1.4 million bpd as of January, up more than 85 percent from two years ago.

The deal values Andeavor, formerly known as Tesoro, at about $152 per share, or about 24 percent more than Friday’s closing price of $122.38.

“We view this as pretty full value for Andeavor,” Scotia Howard Weil analysts said in a note. “Not many saw this one coming.”

MARATHON SHARES DOWN, ANDEAVOR UP

Shares of Ohio-based Marathon lost $6.52, or 8 percent, to close at $74.91 a share. It also missed Wall Street forecasts for quarterly profit by a wide margin on Monday as expenses rose.

FILE PHOTO: Marathon Petroleum Corp refinery is shown after Hurricane Ike hit Texas City, Texas, U.S., September 13, 2008. REUTERS/David J. Phillip/Pool/File Photo

Shares of Andeavor, based in San Antonio, closed up 13 percent at $138.32.

Including Andeavor’s debt, Marathon is paying $35.6 billion to hold 66 percent of a combined company worth some $58 billion at Friday’s close.

Andeavor operates 10 refineries in the United States, largely in the western part of the country. It has pipeline, trucking and terminal operations in the Permian and in the Bakken region, the second-most prolific state for oil production in the country after Texas. (To see an image from the companies, click here: reut.rs/2JFgc58)

“This creates one coast-to-coast, border-to-border refining and marketing company that seems well balanced with a pretty broad footprint,” said Garfield Miller, CEO of Aegis Energy Advisors.

Marathon’s six refineries are largely in the Midwest, with one in Texas City, Texas. The Midwest region has reduced its reliance on crude oil from the Gulf Coast in recent years, pulling more of its barrels from Canada and North Dakota. Now, it is producing more products than it needs and has looked to export markets for additional opportunity.

Analysts at Tudor Pickering Holt said they expected the location of the two companies’ operations to allow them to avoid antitrust hurdles.

Combining the companies’ logistics subsidiaries will not happen immediately, Marathon CEO Gary Heminger said on a conference call following the transaction. He referred to that combination as a “day two issue.”

Andeavor is expanding a retail network of motor fuel stations in the Mexican states of Baja California and Sonora under its ARCO brand.

U.S. Gulf Coast refiners are becoming more integrated in the region’s energy industry, filling shortages created by underinvestment in refining across Latin America.

“There’s no question the new company has greater resource capability going forward into Mexico,” Andeavor CEO Gregory Goff said on a conference call with analysts.

The deal, which is expected to close in the second half of this year, could spur other North American refiners to look harder at acquisitions, said IHSMarkit refining and marketing director Rob Smith.

“This may end up being the biggest of the bunch,” said Smith. “But it would not be surprising to see other mid-tier companies merge.”