In the seventh, Yankees reliever David Aardsma uncorked a wild pitch that allowed Travis Snider to score from third base, and Jeff Larish added a pinch-hit RBI single off Aardsma later in the frame.
One of the runs was charged to left-hander Boone Logan, who was struck by a line drive off the bat of Jose Tabata earlier in the frame and was forced to leave the game.
Logan, who is considered a lock to be in the Yankees' bullpen, was hit in his left hip, but he said he's fine and expects to pitch again Friday.
Hiroki Kuroda spun six innings of scoreless, one-hit ball in his final start of the spring. Slotted to be New York's No. 2 starter, Kuroda walked none and struck out five in the outing.
Locke, who was informed that he will begin the season as the Bucs' fifth starter, allowed four hits over six scoreless innings. Locke walked none and struck out three.
Up next: The Yankees will travel north to Washington, D.C., on Friday, visiting the Nationals for an exhibition game at Nationals Park. Andy Pettitte (1-0, 4.82 ERA) will have the ball for the Yankees in his third start of the spring, tuning up for his April 4 assignment against the Red Sox in New York. Washington counters with Jordan Zimmermann (0-1, 5.40 ERA) for the 2:05 p.m. ET contest.