CLEARWATER, Fla. -- Stupid money? This is more like Mensa money.

By agreeing Wednesday to a four-year, $45 million contract extension with Aaron Nola, the Phillies did more than just lock up their best pitcher through at least 2022 and avoid an arbitration hearing that was scheduled for Thursday. They also maintained one of the best values in baseball, an ace who finished third in the Cy Young Award voting last season while being paid $573,000 and represents a good bet to outpitch his new deal, too.

Nola, who will turn 26 in June, will make $4 million this year, $8 million next year, $11.75 million in 2021, and $15 million in 2022. He also will receive a $2 million signing bonus, and the Phillies hold a $16 million option or a $4.25 million buyout for the 2023 season, during which Nola will be 30.

“Aaron Nola brings a preparation that we can all look up to and our other players can emulate,” manager Gabe Kapler said after Phillies pitchers and catchers held their first workout at the Carpenter Complex. “His between-the-lines competitiveness is off the charts. He’s such a fighter. He’s such a grinder. He’s such a battler.”

Like many of their other recent moves, notably the signings of outfielder Andrew McCutchen and reliever David Robertson and trades for shortstop Jean Segura and catcher J.T. Realmuto, the extension for Nola leaves the Phillies with the financial flexibility to still be “a little bit stupid,” in the words of owner John Middleton in their pursuits of free-agent megastars Bryce Harper and Manny Machado, both of whom remain unsigned as spring training begins.

As recently as last month, Nola said he wasn’t interested in a multiyear extension, a topic that wasn’t even being discussed, according to a league source. Instead, he sounded content to go year to year through the arbitration process before becoming eligible for free agency after the 2020 season. He even filed for arbitration last month, exchanging a $6.75 million salary request for this year with the Phillies’ offer of $4.5 million.

So, what changed? Nola will presumably elaborate on his decision during a news conference Thursday, but a source familiar with his thinking said the right-hander began to consider a longer-term deal only within the past few days. As talks progressed to the point where the average annual value rose to $11.25 million, Nola recognized an opportunity to secure his family’s financial future and still become a free agent at age 29 or 30.

Free agency has been no treat lately, either. Last season, Nola watched as Jake Arrieta didn’t sign until mid-March, when the Phillies made him a three-year, $75 million offer. This year, as spring training begins, more than 100 free agents remain unsigned, including 26-year-old superstars Harper and Machado and durable lefty Dallas Keuchel.

Keuchel’s case figures to be of particular interest to Nola. Three years ago, after winning a Cy Young Award with the Houston Astros, Keuchel received a $7.25 million salary, a record for a first-year arbitration-eligible pitcher. Even if Nola had won his hearing, he wouldn’t have topped Keuchel and still might have faced free-agent uncertainty given the market’s lethargy over the last two winters.

Nola now won’t reach free agency until the winter of 2022-23, at the earliest, by which time a new collective bargaining agreement with potentially friendlier conditions for free agents will have been put into place.

“It’s crazy to think that these guys haven’t been signed -- over 100 guys,” Nola said at Citizens Bank Park last month. “I’ll bet they’re frustrated because it’s getting close to spring training. I’ll bet a lot of guys want to know where they’re at. I’ll bet it’s hard to be with a team for a while and then be a free agent and not be signed anywhere and go through the offseason working out and not be signed.

“I know some guys signed really, really late last year. Jake signed really late. I’m sure it’s tough for them.”

For the Phillies, they achieve cost certainty on their No. 1 starter through what figure to be his prime seasons.

Last year, Nola emerged as an elite starter, posting a 2.37 ERA in 33 starts for the Phillies. He struck out 224 batters in 212 ⅓ innings and finished third in the majors with 0.975 walks/hits per innings pitched. He also had 5.6 Wins Above Replacement, according to Fangraphs. Based on the formula that one WAR is valued at $9 million, Nola was worth about $45 million last year alone.

“He doesn’t want any of the attention. He doesn’t want the spotlight on him,” Kapler said. “He just wants to compete, compete, compete. That’s what he’s done and why he’s one of the two or three best pitchers in the National League over the course of the last couple of years.”

The Phillies selected Nola with the seventh overall pick in the 2014 draft out of LSU. Quiet and unassuming, Nola said last month that he has come to enjoy playing in Philadelphia.

“Being from Louisiana, it was a culture change, but it’s a family over here,” Nola said. “My teammates, the fans, the city of Philadelphia, they welcomed me with open arms. I genuinely appreciate that. They’ve been all good to me.”

And now, he will get to stay for at least the next four years.

Get insights on the Phillies delivered straight to your inbox with Extra Innings, our newsletter for Phillies fans by Matt Breen, Bob Brookover and Scott Lauber. Click here to sign up.