The morning rain stopped, the clouds parted and the sun shone brightly as rookie ace Masahiro Tanaka took the mound and put an end to the Yankees' four-game losing streak in a 2-1 victory over Oakland Thursday afternoon at Yankee Stadium. But it took three innings of quality relief by the bullpen, including a close-shave save by David Robertson to secure the win.

It was the 12th straight quality start of at least six full innings and three or fewer earned runs allowed by Tanaka (9-1), but he was unable to go as deep as usual, exiting after six innings and 104 pitches. Tanaka struck out four and walked one.

Dellin Betances relieved with a perfect seventh inning, but the A's Coco Crisp and John Jaso singled to start the eighth against Adam Warren. They advanced to third and second on a two-out wild pitch, but Warren blew a 96-mph fastball past Yoenis Cespedes to get out of the inning with the 2-1 lead intact.

Robertson, who blew a save on Sunday against Minnesota, struck out the first batter he faced but gave up a single to Stephen Vogt. Pinch runner Craig Gentry stole second and went to third on Alberto Callaspo's groundout that bounced off Robertson's foot to first baseman Mark Teixeira, who then tossed to the pitcher covering first. Robertson fanned pinch hitter Derek Norris looking for the final out and his 13th save.

Tanaka got off to a start that was as dicey as the weather. Jaso, the A's second batter, belted a first-pitch slider deep into the rightfield seats for a quick 1-0 lead. But Tanaka soon settled into a rhythm that has been as reliable as any pitcher in baseball, setting down the next 10 batters he faced.

Two-out singles by Brandon Moss and Cespedes in the fourth ended that streak, but Tanaka got out of the inning by striking out Jed Lowrie. By that point, the Yankees were clinging to a 2-1 lead.

Slumping catcher Brian McCann, who was moved down to seventh in the order against A's lefthander Drew Pomeranz (5-3), singled and advanced to second on an error by leftfielder Moss. Alfonso Soriano snapped out of a 0-for-16 skid with an RBI single to right to tie the game 1-1.

Leading off the bottom of the third, Brett Gardner ripped a first-pitch fastball from Pomeranz into the second deck in rightfield for a 2-1 lead. Unfazed, Pomeranz retired 15 of the next 17 Yankees he faced, allowing only a sixth-inning walk to Jacoby Ellsbury and a seventh-inning double by Soriano that was dropped by centerfielder Coco Crisp, who had trouble with the sun.

Pomeranz threw 101 pitches in seven innings, allowing six hits and only one earned run while striking out seven.