San Antonio will also bring in Marco Belinelli, who agreed to a two-year, $12 million deal with the team, a league source told ESPN's Adrian Wojnarowski.
Belinelli returns to San Antonio after playing a couple seasons for the Spurs between 2013 and 2015. He played a combined 80 games for Atlanta and Philadelphia last season, averaging a career-high 21.1 points per game.
With Belinelli and Gay, the Spurs project to have $107 million in committed salary, according to ESPN's Bobby Marks. The Belinelli contract will hard cap the Spurs at $129 million, based on the guard's using more than the $5.3 million midlevel exception.
On June 14, Gay opted out of the final year of his contact with the Spurs that paid $8.8 million. Yahoo! Sports first reported Gay's new deal.
The 12-year NBA veteran averaged 11.5 points and 5.1 rebounds last season in his first season with the Spurs in a career-low 21.6 minutes per game.
The 6-foot-8, 230-pounder also proved last season that he had recovered from the season-ending Achilles tendon tear that he suffered during his 2016-17 campaign with the Sacramento Kings.
Marc J. Spears of ESPN's The Undefeated contributed to this report.