Boeing Co has won a contract worth over $30 billion to build new refueling planes for the U.S. Air Force, beating out Europe's EADS, the Pentagon said on Thursday.

Air Force Secretary Michael Donley told reporters the contract was worth over $30 billion and Boeing's shares rose nearly 4 percent in after-hours trading.

Deputy Defense Secretary William Lynn said Boeing was the clear winner in the competition, contrary to expectations of many analysts earlier on Thursday.

EADS has 10 days to file a formal protest after a contract award, but congressional backers of the losing side can also seek to reverse the move legislatively.

Teal Group aerospace analyst Richard Aboulafia called the decision a major surprise. But said if the decision holds, Boeing will have succeeded in blocking EADS's biggest defense initiative.

The Air Force has failed with two previous attempts to begin replacing its 50-year-old KC-135 Stratotankers, which provide fuel to fighter planes and other aircraft in mid-flight, extending the range of military operations.

The decade-long saga has sparked transatlantic tensions and clashes in Congress among lawmakers eager to bring high-paying aerospace jobs to their states.

EADS and Boeing, arch rivals in the market for passenger jets, have fought bitterly in public over the contest with expensive advertisements while their respective supporters have battled it out at dueling news conferences.

Any protest against the decision would be filed with the Government Accountability Office, the arm of Congress which rules on federal contract disputes. The GAO would then have 100 days to rule on the case.

The Air Force has been trying since 2001 to begin replacing its Boeing-built KC-135 tankers.

An initial $23.5 billion plan to lease and then buy 100 modified Boeing 767s as tankers, fell apart in 2004.

EADS, partnered with Northrop Grumman Corp, won a 179-plane deal in February 2008, only to have it canceled after government auditors upheld parts of a protest by Boeing.

Northrop subsequently pulled out, leaving the European aerospace and defense company to bid alone.

(Reporting by Andrea Shalal-Esa and Tim Hepher; Editing by Tim Dobbyn, Dave Zimmerman)