Keith Wilson, president of the Allied Pilots Association, announces results of the vote on a new contract with American Airlines in the lobby of the union headquarters Friday in Dallas.

American Airlines pilots agreed to a new contract Friday, their union said, paving the way for the carrier to come out of its yearlong bankruptcy.

The Allied Pilots Association said the new collective agreement was endorsed by 74 percent of pilots who cast a ballot. In August, in a surprise move, American’s pilots overwhelmingly rejected a similar deal with the airline.

The union said 96 percent of its eligible members voted on the new contract, with 5,489 in favor and 1,951 against.

With a new contract, American Airlines has mostly completed its reorganization. This was the last big hurdle to clear before the carrier and its creditors could focus on the big strategic question looming: Should American pursue a merger with US Airways or remain independent for now?

Many analysts expect the two airlines to combine. A merger would give the enlarged entity the size to compete with Delta Air Lines and United Airlines, both of which overtook American after their own mergers with other carriers in recent years.

Tom Horton, American’s chief executive, has insisted throughout the bankruptcy that American will emerge as a stand-alone carrier. But under pressure this summer from his counterpart at US Airways, Doug Parker, Horton agreed to look at a merger and outline its strategic benefits to the company’s creditors as an alternative to his own plan.

The labor situation at American has sharply deteriorated in recent years and has been further clouded by US Airways’ involvement. In an unusual show of defiance against American’s management, the airline’s labor groups — including pilots, flight attendants and mechanics — have all supported Parker’s merger plans.

After the vote, the pilots’ union repeated its support for a merger with US Airways, saying it was “the best path to a stronger, more competitive American Airlines that will in turn enhance our pilots’ long-term career prospects.”

Getting a new pilot contract was critical for American to successfully emerge from bankruptcy. A deal was needed before the company’s board and its creditors could consider whether to opt for a combination. A federal bankruptcy judge will have the final say on the matter.

American’s top three unions, representing pilots, flight attendants, and mechanics and other ground workers, each has one seat on the company’s nine-member unsecured creditors’ committee.

American Airlines called the agreement “an important step forward in our restructuring.”

“Today’s ratification gives us the certainty we need for American to successfully restructure, providing opportunity and growth for all of our people and stakeholders,” American said in a statement. “The modernization of our company is well under way, and we remain focused on emerging as a competitive, world-class airline.”

American and its pilots have been negotiating a new contract since 2006. The union has urged its members to ratify this latest deal, which would give pilots a pay raise and a 13.5 percent stake in the carrier once it comes out of bankruptcy.

It also establishes new work rules requiring more flight time for pilots and freezes their pension. It also allows American’s regional airlines partners to fly bigger planes, an issue that has long been a sticking point in labor talks.

The previous agreement, which called for similar concessions and benefits from the pilots, was opposed by 61 percent of pilots in a show of defiance.

After that vote, American imposed more draconian terms on its pilots and quickly sought to negotiate a new deal with its union. In response, some pilots called in sick in greater numbers and reported more mechanical problems with planes, leading to wide flight delays and cancellations.

In recent years, American lost its top position and retrenched of its operations around five big hubs — Dallas, New York, Los Angeles, Miami and Chicago. It has been hobbled by higher costs than its competitors, who have all used bankruptcy proceedings mainly to restructure their labor contracts.

Earlier this week, the Allied Pilots Association urged its members to endorse the new deal, which it said was equal to or better than contracts at United, US Airways and Delta.

“We must at some point come to grips with the new reality of no longer being the `big dog’ in the industry that we once were,” the union’s vice president, Capt. Tom Chapman, said in a message to the pilots. “The American brand has been severely damaged, and it may take a while to repair.”

“AMR’s existing plan is essentially the same failed strategy that drove the company to failure over the past decade,” said Vicki Bryan, an analyst at Gimme Credit. “We remain convinced that the best solution for AMR is to be run by someone else, and the best candidate in our view still is US Airways.”