The union representing about 2,500 Southwest Airlines mechanics voted overwhelmingly on Tuesday to ratify a new contract proposal, ending a labor impasse that lasted nearly seven years and wound up in court twice.

The five-year deal gives the mechanics $160 million in back pay to cover the period since the last contract ended in August 2012, increases salaries 20 percent immediately and includes 3 percent annual raises, according to the union, the Aircraft Mechanics Fraternal Association.

In a statement, the union said that the proposal was better than one it rejected in September, and that more than 90 percent of its members had voted to approve it. The union said its major concession was allowing Southwest to continue outsourcing some mechanics’ work to foreign contractors.

“Our focus now shifts to working together with Southwest Airlines, as we do the important work of restoring the safety culture Southwest Airlines has traditionally been known for,” the union’s statement said.