The Yankees' pursuit of Oakland Athletics starter Sonny Gray spilled into the final hours before Monday's trade deadline, but a swap has been reached that sends the right-hander to New York.

The Athletics are getting back shortstop/outfielder Jorge Mateo, outfielder Dustin Fowler and pitcher James Kaprielian while also sending the Yankees $1.5 million in international signing money.

"This team has shown it's got the ability to allow us to push a lot of these chips in the middle of the table and recognize 2017 has a chance to be special,'' general manager Brian Cashman said. "We're trying to go from good to great.''

Oakland is taking on two injured players. Fowler ruptured the patellar tendon in his right knee on June 29, 2016, during his first game in the majors last season; Kaprielian had Tommy John surgery on April 18.

Gray, 27, is under club control through the 2019 season. He is making $3.6 million this season and is arbitration-eligible in 2018. Yankees manager Joe Girardi said Gray is likely to make his Yankees debut early on the team's next trip, which begins Thursday night in Cleveland.

Gray is 44-36 with a 3.42 ERA over parts of five seasons in Oakland. Gray has pitched well lately, with a 1.37 ERA, 36 strikeouts and 9 walks in his past six starts.

Gray further strengthens a Yankees rotation that includes Luis Severino, Masahiro Tanaka, CC Sabathia and Jaime Garcia, who was acquired Sunday from the Minnesota Twins. He complements a strong bullpen featuring Aroldis Chapman, David Robertson, Dellin Betances, Adam Warren and Tommy Kahnle.

"I think we've definitely improved ourselves,'' Girardi said. "When I look at ownership and the front office, they've given us an opportunity to do something special here. Now we have to go out and do it.''

Gray first spent a stint on the disabled list from May 21 to June 4 last year with a strain in his upper back, then went back on the DL again with a strained right forearm. After getting hurt Aug. 6, the 27-year-old Gray didn't pitch again until one inning of relief Sept. 28 at the Los Angeles Angels. Gray had been scheduled to start for the A's on Monday night against San Francisco. As the trade deadline approached, the Athletics pushed back his start a couple of days.

"The marathon's winding down and it's time to sprint to the finish line, and so we've done everything we possibly can to date to continue to excel,'' Cashman said.

Last season, the scuffling Yankees stockpiled prospects at the trade deadline by dealing away veteran stars Andrew Miller, Aroldis Chapman and Carlos Beltran. New York missed the playoffs last year and has not won a postseason series since 2012.

So to get Gray and several other big league pieces recently, Cashman dipped into one of baseball's deepest farm systems.

"The last few years here were disappointing,'' outfielder Brett Gardner said. "Our goal is to win the division. The wild-card thing isn't good enough.''

Following news of the Gray trade, the Yankees' odds to win the World Series improved from 10-1 to 7-1 at the Westgate Las Vegas SuperBook while their odds to win the American League pennant improved from 4-1 to 3-1.

The Yankees are 56-47 and lead the Boston Red Sox by a half-game in the AL East after taking three of four games from the Tampa Bay Rays over the weekend.

In addition to obtaining Gray, the Yankees recalled RHP Jonathan Holder from Triple-A Scranton/Wilkes-Barre and traded minor league right-hander Yefry Ramírez to Baltimore for international signing bonus pool money. After the game, they optioned Holder and 1B Garrett Cooper back to Triple-A.

New York has increased its international signing bonus pool from $4.75 million to $8 million for the current period that began July 2, tying Boston for the most among major league teams. The Yankees have already spent $3.8 million of that allotment.

ESPN's Jerry Crasnick, ESPN Stats & Information and The Associated Press contributed in this report.