Jason Hammel's right hand may be stiff and sore after being plunked with a first-inning liner, but there is nothing like a win to ease the pain.

The Chicago Cubs right-hander threw 5 2/3 innings of four-hit ball as the Cubs beat the New York Yankees and Japanese sensation Masahiro Tanaka 6-1 on a rainy Tuesday at Wrigley Field.

Hammel, signed by the Cubs after they lost out in bidding for Tanaka last winter, outdueled his higher profile counterpart by allowing just one run, while striking out six and walking just one.

"I got a good little egg on there," Hammel said of his injury, "but adrenaline was able to carry me through. It gradually got stiffer and sorer ... a little worse as the game went on, but I was able to get through it."

Hammel was struck on his right hand by leadoff better Brett Gardner's first-inning shot. After an examination and a few warmup pitches, he remained in the game.

Hammel (5-2) had solid offensive support from his Cubs teammates as second baseman Luis Valbuena went 3-for-4 and scored twice while catcher John Baker snapped a 3-for-32 slump with a pair of hits and an RBI.

Tanaka (6-1) suffered his first major-league defeat and first regular-season loss since Aug. 19, 2012, while pitching in Japan.

"I thought his split was not as consistent as it's been," Yankees manager Joe Girardi said. "And that's a huge pitch for him obviously. He left a couple up and that was probably the difference."

The game opened with humid, summer-like conditions and temperatures in the mid-80s. Rain arrived in the third inning with light showers on and off the rest of the night.

Yankees shortstop Derek Jeter, honored by the Cubs before the game for his lengthy major-league career, went 2-for-4. Gardner also had two hits as New York dropped its second straight.

Cubs center fielder Emilio Bonifacio also had two hits, scored one run and drove in another. Third baseman Mike Olt was 1-for-2 with three RBIs.

The Yankees scored their lone run with two outs in the sixth and forced Hammel from the game after Gardner came home from second on first baseman Mark Teixeira's RBI base hit.

The Cubs replied with two runs in the sixth. Olt's sacrifice to left drove in Valbuena from third, and Baker's fly to center brought home right fielder Nate Schierholtz.

Tanaka worked through six innings and gave up four runs (three earned) on eight hits. He struck out seven and walked one.

"I don't think it's just the splitter," Tanaka said through a translator. "I think it goes for all of my pitches today. I don't think I was able to command my pitches the way I wanted to. If I knew why I wasn't able to do it, then I'll be able to adjust it during the game."

Bonifacio then greeted right-handed reliever Preston Claiborne with a leadoff triple to center. Shortstop Starlin Castro's RBI single with one out drove home Bonifacio for a 5-1 Cubs lead and chased Claiborne.

The Cubs had the bases loaded before right-handed reliever Matt Daley -- the inning's third pitcher -- walked Olt to bring home first baseman Anthony Rizzo for a 6-1 lead.

The Yankees loaded the bases with two outs in the ninth with Jeter at the plate, but Cubs reliever Hector Rondon got him to ground out.

Gardner's first-inning grounder off Hammel's hand put him on base. Gardner advanced to second on Jeter's sacrifice bunt and reached third on a two-out wide pitch but didn't score.

"We were very fortunate," Cubs manager Rick Renteria said. "The ball struck him in the back of the hand and the first warmup pitch that he ended up launching I was a little concerned. He threw the next pitch and continued to warm up and looked normal. He said he was fine ... and was able to give us a nice outing."

In the second, Valbuena doubled to right-center with one out and reached third on Schierholtz's sacrifice bunt. But he was stranded as Olt struck out.

Jeter singled and stole second with two outs in the third but failed to advance.

Bonifacio drove in the game's first run in the bottom of the inning, singling to center to score Baker for a 1-0 lead as rain arrived. Tanaka walked first baseman Anthony Rizzo with two outs but escaped without further damage as Castro grounded to second.

The Cubs made it 2-0 in the fourth on Olt's one-out RBI single to left that scored Valbuena. The Yankees got back-to-back forces at the plate on Cub bunts to get out of the inning.

NOTES: Tuesday's series opener at Wrigley Field was the Yankees' third in a nine-game road trip that includes a four-game series at the White Sox later this week and a three-game set in St. Louis. ... The Yankees are 7-6 in inter-league play this season and 186-129 all-time, best in the majors. ... The Cubs saluted Yankees SS Derek Jeter with presentation of a No. 2 -- his uniform number -- from Wrigley Field's manual scoreboard prior to the game. Jeter was playing in only his fourth game at Wrigley Field on Tuesday but he's baseball's all-time inter-league leader in hits (356), runs scored (198) and games played (269). ... The Yankees send RHP Chase Whitley (0-0, 0.00 ERA) against Cubs RHP Jeff Samardzija (0-4, 1.62 ERA) in Wednesday's series finale. ... Samardzija has the National League's second-lowest ERA and is eighth in innings pitched (61.0). ... Cubs starter Jason Hammel was no stranger to the Yankees, facing them 18 times previously, including 12 starts, mostly with the Tampa Bay Rays and Baltimore Orioles. ... 3B Mike Olt leads the Cubs with nine home runs and has the most prior to June 1 since Geovany Soto in 2008. But he otherwise struggles at the plate with a .176 average. ... The Cubs and Yankees have played in two World Series (1932 and 1938), both New York sweeps.