It’s time to play ball.

At last.

One day after talks stalled and commissioner Rob Manfred lopped more games off the schedule, 99 days after the owners locked out the players, and with the chair of the Senate Judiciary Committee threatening the league’s antitrust exemption, Major League Baseball and the Players Association on Thursday finalized a collective bargaining agreement that will allow for a 162-game season in 2022.

The deal, which was opposed by the union’s executive subcommittee but passed in an overall vote of 28-12 by player leadership, was ratified unanimously by the 30 owners, bringing MLB’s first work stoppage in a quarter-century — and the second-longest in its history — to a merciful conclusion.

Free agency resumed Thursday night. Spring training is expected to open Sunday. Opening Day is scheduled for April 7, with the Phillies playing their first game April 8 at home against the Oakland A’s. MLB intends to reschedule the 14 days’ worth of games that it erased, with players receiving full pay and service time.

» READ MORE: Trade generator: Proposals for the Phillies landing Whit Merrifield, Matt Chapman and more

“The new collective bargaining agreement represents progress for all parties involved,” Phillies owner John Middleton said in a statement. “I believe with our agreement it will ultimately improve the game for our fans, who deserve the absolute best for their patience in this process. Baseball is finally back, and I am beyond thrilled that the 2022 season is upon us.”

Get ready now for a frenzy of transactions, as teams cram three months of offseason activity into about three weeks. A few hundred free agents are unsigned, including Carlos Correa, Freddie Freeman, and Kris Bryant. Trades that were brewing before the lockout will percolate again. The Phillies need two outfielders, a few late-inning relievers, and starting-rotation depth. Other teams have similarly long to-do lists.

General managers, start your engines.

Not all of the core economic elements of the five-year CBA were immediately available, but MLB’s last proposal reportedly included an initial luxury-tax threshold of $230 million this year, rising to $244 million by 2026; a raise in the minimum salary to $700,000 this year and $780,000 by 2026; and a $50 million bonus pool for pre-arbitration (entry-level) players.

Other highlights of the deal, according to sources, include 12-team expanded playoffs, a six-team draft lottery, a 45-day window for MLB to implement on-field rule changes, the universal designated hitter, and commerical patches and decals on uniforms.

» READ MORE: Ain’t that American: Baseball finally returns

In a news conference Thursday night, Manfred apologized to the fans. He also conceded that his relationship with the locked-out players soured and said, “It’s going to be a priority of mine” to strengthen it.

“I hope that the process is a first step forward,” said Manfred, who called the CBA an “olive branch” to the players. “I spoke to [MLBPA executive director] Tony [Clark]. I told him that I thought we had a great opportunity for the game in front of us.”

In a statement, Clark said the players made “significant progress in key areas that will improve not just current players’ rights and benefits but those of generations to come.”

Before MLB and the players could shake hands, they had to overcome a roadblock: the creation of an international amateur draft in 2024.

The owners want it and tried this week to attach it to their agreement to drop draft-pick compensation for free agents who receive a qualifying offer. The players rejected the draft in multiple previous proposals and were opposed to it again. In fact, it has been a contested topic dating to the 2016 CBA negotiation.

Ultimately, the sides agreed to continue to negotiate over the draft until July 25, at which time the players either agree to it and the removal of draft-pick compensation or decline it and compensation remains in place.

Once that was sorted out, MLB and the players could finalize the rest of the agreement.

When the week began, the thought of an agreement seemed improbable. But the owners made meaningful steps toward the players on core economic issues, including the linchpin item of the luxury tax, during a 17-hour negotiation Tuesday that spilled into the wee hours Wednesday.

» READ MORE: Baseball is back ... ‘where am I signing?’ Former and current players react to the end of the lockout

After seeing their average salary decline over the last four years while owners’ revenues rose to a peak of $10.7 billion in 2019, the players were steeled for a prolonged fight. They sought to rework MLB’s service time-based pay structure, which disadvantages a majority of players, and to achieve greater competitive integrity in a time of tanking for draft picks.

The owners voted to lock out the players on Dec. 2, minutes after the expiration of the CBA. Manfred called it a “defensive” maneuver and said it would reboot negotiations that stalled Dec. 1 in Dallas. Team employees weren’t permitted to communicate with players. The league scrubbed MLB.com of players’ photos.

But MLB waited 43 days to re-engage the players on core economics. In January, talks were brief and intermittent. The sides held meetings on back-to-back days only once until the nine-day summit in Jupiter, Fla., that began on Feb. 21, nearly a week after pitchers and catchers had been scheduled to report to spring training.

And still, it took this week’s overnight bargaining session in conference rooms six blocks apart in midtown Manhattan -- baseball’s version of a New York City marathon -- for the sides to make real headway.

Was a lockout necessary?

“I believe that, in sports, an offseason lockout is the most effective way to get to an agreement without losing games,” Manfred said. “My strong preference is always to make an agreement before expiration. Wasn’t possible here.”

The players didn’t succeed in fundamentally restructuring MLB’s economics. They achieved neither earlier free agency nor expanded salary arbitration. They didn’t upend the revenue-sharing system. But in the negotiations, changes were always going to be more incremental than monumental.

On that count, the players believe they made gains.

The minimum salary will be 22.7% higher than last year. The creation of the bonus pool will allow entry-level players to boost their salary via high performance. The universal DH figures to help hike salaries, too. The advent of a draft lottery will make it less advantageous for noncontenders to race to the bottom, while draft-pick sweeteners will give teams less reason to manipulate a rookie’s service time. And the initial luxury-tax threshold, effectively a salary cap in 2021 for several teams (including the Phillies), will rise 9.5% from a year ago.

The owners, meanwhile, achieved their goal of expanded playoffs, albeit a 12-team format rather than their preferred 14 teams. They gained another revenue stream from the uniform ads. They also got the union to at least consider the international amateur draft, all while preserving the essence of an economic system that works decidedly in their favor.

Manfred got something out of the deal, too: a 45-day window, beginning in 2023, to implement rules changes that are deemed worthwhile by a competition committee heavier on management than player representation.

When the week began, an agreement on any of those things seemed remote.

Now, at last, it’s nearly time to play ball.