Sun Country Airlines and its pilots have a new contract after five years of start-and-stop negotiations.

With a gleaming, one-year-old 737 aircraft as their backdrop, Sun Country executives and union leaders on Thursday afternoon signed the contract that gives pilots a raise of between 20 and 30 percent in the first year.

The agreement, reached last month under supervision of the National Mediation Board, diminished tension between the Mendota Heights-based airline and its pilots, represented by the Air Line Pilots Association, also known as ALPA.

“Our pilots have earned and deserve the contract we have put together,” Marty Davis, Sun Country’s chairman, said at the signing ceremony. “Now we will cohesively move forward.”

Nearly all of the 250 pilots voted on the agreement, with 87 percent approving the terms. The new contract goes into effect Sunday.

“We’ve reached an agreement that will lift us up to economic respectability among our peers,” said Brian Roseen, chairman of ALPA Sun Country.

The carrier’s pilots were making 45 percent below the industry average before this new contract, said Darin Kluck, a Sun Country pilot. The new contract terms raise a new hire’s pay from $30 an hour to $48 an hour and incremental increases over the contract’s five-year life span. The pay for senior captains jumps from $132 an hour to $161 an hour, topping out in 2019 at $201 an hour.

“It was a long process, and no contract is perfect,” Kluck said. “We stuck by the airline through two bankruptcies. This new contract recognizes our pilot group for their contributions to the airline’s current and future success, as well as our sacrifices in years past. We are proud to serve Sun Country.”

In February, the pilots voted in February to authorize a strike, but they never set a date. Davis cautioned that the carrier could face a “downsizing” if a labor agreement was not reached. Executives at the Metropolitan Airports Commission, which operates Minneapolis-St. Paul International Airport, were so worried about the airline’s future that they temporarily suspended plans for a $35 million expansion at Terminal 2, where Sun Country has its gates.

“I understood what they thought they needed — and I agreed,” Davis said. “It was never a matter of ideology, but economic reality.”

Following a tumultuous 2014, the airline turned profitable this year, making room for compromise, Davis said.

“It is good to have this settled,” Davis said. “It allows the focus of the company to take new life and new height.”

After the signing, Davis, whose family has owned the airline for four years, climbed into the jet’s cockpit and sat in the captain’s chair for the first time.

“It’s really cool up there,” he said. “You get a great view.”