The Yankees dealt infielder Yangervis Solarte and minor league pitcher Rafael De Paula to San Diego in exchange for Headley, who could boost New York's struggling lineup.
The Padres also will send $1 million to the Yankees in the deal, a source told ESPNNewYork.com's Andrew Marchand. Headley is scheduled to become a free agent after this season.
General manager Brian Cashman called Headley "an upgrade" over Solarte, a rookie who had a great April but tailed off steadily and was sent back to the minor leagues in July but was recalled a week later when Carlos Beltran went on the 7-day disabled list with a concussion.
"I think he can certainly deliver a long ball and this ballpark is certainly more conductive to that than where he's coming from," Cashman said. "I think he's a professional hitter and a switch-hitter that can spray it all over the place. I don't think we're getting a big thumper, but I do think we're getting an upgrade and a professional at-bat. He's going to give you a good at-bat."
The 30-year-old Headley is batting just .229 with seven home runs and 32 RBIs this season but could help a Yankees offense that entered Tuesday with a team average of .252.
Headley is hitting .323 in the month of July.
"He's a guy that's put up big numbers in the past and has been swinging the bat extremely well. You look at his last month and it's been really productive," Yankees manager Joe Girardi said Tuesday. "We feel that he's in a pretty good place coming over here. He plays in an extremely big ballpark, big ballparks during the course of the season playing in the West. I think this place will help him."
Girardi said he expected Headley to be his everyday third baseman for the remainder of the season. Headley was not scheduled to arrive until after the start of Tuesday night's game with the Rangers but Girardi said he would be available to pinch-hit late in the game.
Headley hit 31 home runs and led the National League with 115 RBIs in 2012. His numbers dipped to .250 with 13 homers and 50 RBIs a year ago after he rebuffed the Padres' willingness to negotiate a deal during the season.
Headley settled on a one-year, $10.5 million contract in January to avoid arbitration.
Cashman said the Yankees were satisfied that Headley's back problems, caused by a herniated disk, had been alleviated by an epidural injection administered in June.
"There's some risk, but they appear to be something that's manageable and it's been managed really well," Cashman said. "He's a rental for the next two months, but our assessment of him by scouting, by performance, and the medicals, is it's a low risk. So we're excited to have him here."
ESPNNewYork.com's Andrew Marchand and Wallace Matthews and The Associated Press contributed to this report.