ANAHEIM, Calif. -- Scott Kazmir wanted to do to the Tampa Bay Rays what John Lackey did to the Angels last week in Boston: come up with a dominating performance in his first outing against the team he started out with in the major leagues.
"That's exactly what I envisioned," Kazmir said.
It didn't turn out that way, though.
"It's very disappointing," Kazmir said. "There's a lot of history there and a lot of good friendships I made over the years -- not just with the players and staff, but with the community."
The victory was only the second by the Rays in 16 games at Anaheim since former Angels bench coach Joe Maddon became Tampa Bay's manager.
"It's awkward to see Kaz in red and white. Let me put it that way," Maddon said. "But we've kind of moved along, and we really like what we have going on here. I like our pitching staff. I really wish Kaz well here, but I don't really dwell on that kind of stuff."
Niemann (3-0) took a shutout into the eighth inning and Longoria had a homer and four RBIs for the Rays, who improved their major league-best record to 23-10 and increased their AL East lead over the Yankees to a full game after New York was rained out in Detroit.
Niemann was charged with two runs and six hits over 7 1/3 innings, struck out four and stranded a runner in scoring position in each of the first three innings before handing a 6-0 lead over to the bullpen. The 6-foot-9 right-hander has pitched at least seven innings in five of his last six starts, and came within one out of doing so the other time.
"That's been hammered into our heads since spring training, that the starters go deep into the game. And we've been doing a pretty good job of it," Niemann said after the Rays snapped a three-game skid. "We were all pretty amped up to face Kaz, a guy we know pretty well. So it was good to get a win and stop the bleeding."
Niemann departed after giving up a leadoff single to Brandon Wood and a one-out walk to Bobby Abreu. Torii Hunter greeted Lance Cormier with an RBI single, and Kendry Morales singled to load the bases.
Randy Choate came in and walked Hideki Matsui on four pitches to force in a run, but Grant Balfour restored order by striking out Howie Kendrick and retiring Michael Ryan on a fielder's choice grounder.
Kazmir (2-3) threw 108 pitches in five innings, allowing three runs and seven hits with two strikeouts and three walks. The two-time All-Star has failed to reach the seventh in any of his six starts this season, after spending the first two weeks on the disabled list because of a right hamstring strain that interrupted his spring training regimen.
"I know I have what it takes to be a quality starter in this league," he said. "It's just a matter of me going out and relaxing and having fun and not putting too much pressure on myself."
Kazmir is 4-5 with a 4.05 ERA in 12 starts since joining the Angels. Right-hander Wade Davis, who replaced Kazmir in the Rays' rotation after the trade, is 5-4 with a 3.46 ERA in 12 starts since his promotion from Triple-A Durham last September.
"It was definitely tough to face them for the first time, and it felt a little strange," Kazmir said. "But once the game started, it didn't really affect me at all -- just that one time, the first at-bat by B.J. (Upton), when he was looking at me and smiling. I had to take a step back, look into the stands and kind of refocus."
Kazmir, Tampa Bay's career leader in wins, starts, innings, and strikeouts, was traded to the Angels last August 28 for three players. One of those players, second baseman Sean Rodriguez, was 2 for 4 with a double and scored the game's first run in the third inning on the first of Carl Crawford's three consecutive singles.
Opposing batters are 0 for 12 against Niemann with two outs and a runner in scoring position. ... Rays 1B Carlos Pena, who has only one hit in his last 40 at-bats and is hitting just .179, didn't start but came in as a defensive replacement in the seventh.