The Phillies, a year after neglecting to add a starting pitcher, have appeared to learn from their misstep. They agreed to terms Wednesday with former Mets right-hander Zack Wheeler on a five-year, $118 million contract, a source confirmed, to begin an offseason that focuses on their rotation. The Athletic was the first to report the deal.

Wheeler, 29, is not Gerrit Cole or Stephen Strasburg, the two premier pitchers on the free-agent market, but he could develop into an elite arm. He has a powerful fastball and was finally healthy the last two seasons after injuries hindered him for most of the previous three.

The Phillies will slot him into a rotation headed by Aaron Nola, and they will likely add another starter to accompany Jake Arrieta and Zach Eflin, Vince Velasquez, or Nick Pivetta. Spencer Howard, the team’s top pitching prospect, will reach the majors sometime in the first half of the 2020 season. Their pursuit of starting pitching is not yet finished.

Wheeler’s $23.6 million average annual value is slightly more than what the Phillies could have paid last winter to sign Patrick Corbin. But they were leery of giving Corbin a six-year deal, which the Washington Nationals ultimately did. The rotation struggles last year were enough to drive away those concerns, yet waiting a year came with a price: The Phillies had to pay an even larger premium for starting pitching.

Similar to Corbin, the attraction to Wheeler is what he could become more so than what he has been. The Phillies passed on Corbin, who, like Wheeler had undergone Tommy John elbow surgery, and watched him post a 3.25 ERA with Washington as he continued to develop into a top-flight pitcher. The same, they hope, will happen to Wheeler.

Wheeler missed the 2015 and 2016 seasons after his surgery. He then made just 17 starts in 2017 because of a series of arm complications. Healthy for 2018 and 2019, Wheeler had a combined 3.65 ERA and averaged 8.9 strikeouts per nine innings over 60 starts.

For stretches of the last two seasons, he was one of baseball’s best pitchers. The Phillies will now have to figure out how to expand that success.

His 2.83 ERA after last season’s All-Star break was the eighth-best mark among major-league starters. He showed enough promise in his final 12 starts to become just the fourth player to get a $100 million deal with the Phillies, joining Bryce Harper, Cliff Lee, and Ryan Howard.

Wheeler found that success despite allowing a .309 batting average on balls in play (BABIP) that was above the league average, indicating that Wheeler was somewhat unlucky. Wheeler already limits his walks and strikes out enough batters. The Phillies, who improved drastically in the field last season, should provide better defense behind him. There are reasons to believe he could be even better.

Wheeler’s average fastball last season was 97 mph, as his velocity moved beyond what it was before his Tommy John surgery. Just four pitchers — Noah Syndergaard, Gerrit Cole, Luis Severino, and Jacob deGrom — have thrown more 97-mph-or-greater pitches than Wheeler over the last two seasons. He has thrown 1,111. Phillies starters have thrown 40. Just two National League clubs have thrown fewer than the Phillies, who finally have a power arm in their rotation.

The Phillies had just one starter last season finish with an ERA better than 4.22. Their rotation had the fifth-highest ERA in the National League, allowed homers at the third-highest rate, and recorded the sixth-lowest strikeout rate. There was a slew of reasons the Phillies missed the playoffs for the eighth straight season, but the troubles of the starting rotation topped the list.

That is why manager Joe Girardi said Tuesday night that “pitching has been a focus for us.” The Phillies will improve their lineup, they’ll add reinforcements for their bench, and they’ll search for upgrades for their bullpen. But the success of this offseason will be defined by how their starting rotation looks in February when the team arrives at spring training. Landing Wheeler is a start.

“He knows it’s important that we add pitching,” Girardi said of general manager Matt Klentak. “You go into a season thinking that you’re going to need five starters and you always need six, seven, eight because things happen. They have been working hard, and we keep our fingers crossed.”