Major League Baseball and the players union, knowing there was far too much at stake for an impasse, agreed to a new five-year collective bargaining agreement Wednesday night less than four hours before their current deal expired.

The deal, which still needs to be ratified by the owners and players, means there will be 26 consecutive years without a work stoppage since the 1994-95 players’ strike that cancelled the 1994 World Series.

A baseball official with direct knowledge of the negotiations confirmed that MLB and the union wrapped up the five-year deal. The official spoke on condition of anonymity because the accord has not yet been announced.

Commissioner Rob Manfred voiced optimism all along that a labor deal would be consummated before the deadline, and the last obstacle was agreeing to a new luxury tax that will start at $195 million, and top out at about $210 million over the agreement's five years. It still leaves the Los Angeles Dodgers, New York Yankees, Boston Red Sox and Detroit Tigers over the limit in 2017.

The new deal, which appears not to have any major changes than the previous agreement, still will not have an international draft, but instead a cap what teams can spend in the international market. There also will be no increase to the 25-man roster, with teams permitted to have a 40-man playing roster in September.

MLB and the MLBPA have been negotiating since March on a new CBA to replace the five-year agreement that was set to expire after midnight Wednesday. However, it was thought to be a soft deadline, and both sides were prepared to continue negotiating to avoid a lockout.

Sides continued making progress Wednesday night on key issues, most notably the luxury tax threshold.

With baseball approaching nearly $10 billion in annual revenues, motivation was strong on both ends to maintain labor peace, a streak that will now stretch from 1996 into 2021. With that in mind, owners dropped their hopes of imposing an international draft on foreign-born amateurs.

Once the agreement is ratified by both sides, baseball's off-season can continue just as it was scheduled to swing into high gear. The game's off-season carnival - the winter meetings - begin on Monday outside Washington D.C., now with assurances that team executives and agents can wheel and deal without the specter of a lockout hovering.