SURPRISE, Ariz. (AP) – Two of the three hits Matt Cain allowed left the park Thursday night. In the end, it didn’t matter.

Cain allowed two runs in seven innings and the San Francisco Giants rallied to beat Texas 6-2, snapping the Rangers’ three-game winning streak.

“I threw some good sliders and threw some bad ones,” said Cain, who has allowed four earned runs in 20 2/3 innings for a 1.74 ERA. “I think I need to think about what I need to do to throw more good ones.”

Mike Napoli and Mitch Moreland hit consecutive home runs to start the second inning for the Rangers, but Cain didn’t allow another hit until Josh Hamilton doubled to lead off the seventh.

“After that, he really settled down and pitched great,” Giants manager Bruce Bochy said. “It’s good for him to have a game like this as we get close. Matt’s ready.”

Cain retired the first three batters he faced, and then 17 of his final 19.

Cain will be the Giants’ third starter behind Tim Lincecum and Madison Bumgarner.

“He’s not a No. 3 starter,” Bochy said. “That’s just the way things fell in our rotation. He’s one of the better pitchers in the game.”

Matt Harrison was equally as effective for the Rangers, allowing a run on six hits in six innings. He struck out seven and walked one.

Harrison has allowed only 11 hits and two walks in 16 innings across four starts this spring.

“I think I’ve been really consistent in terms of pounding the strike zone and getting ahead of guys,” Harrison said. “I’ve got the attitude that I’m coming right at you and being aggressive with every pitch I have. It’s paying off.”

Yoshinori Tateyama came in for Harrison and promptly surrendered three straight singles to begin a three-run, four-hit Giants rally.

Joaquin Arias, a one-time Rangers farmhand, homered to lead off the ninth for San Francisco.

(© Copyright 2012 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)