DENVER (AP) — Only took until June, but the Colorado Rockies captured their first series at Coors Field.

Nearly had a sweep, too. Against the team with the top record in the majors, no less.

Didn't quite work out as Chad Bettis, the closest thing Colorado has to an ace, felt "out of whack" in a 4-2 loss to the St. Louis Cardinals on Wednesday.

Still, it was a productive homestand with the Rockies finishing 5-5 by taking two of three from the Cardinals.

"Bottom line, we ended up this homestand with a series win against arguably the best club in baseball," Rockies manager Walt Weiss said. "It's a good way to end it."

Bettis (2-1) never really settled into a comfortable rhythm. He allowed three runs in five innings as the Rockies lost for the first time in a game he's started.

"Just felt a little rushed through my delivery throughout the whole game," Bettis explained. "Other than that, just got to keep the ball down."

Carlos Martinez (7-2) had a shutout until Ben Paulsen's two-run homer in the seventh. That's about the only mistake Martinez made. But even that 88 mph changeup wasn't really a mistake. He thought he made a good pitch — just not at this ball park.

"I didn't expect the ball to fly that far," Martinez said.

The right-handed Martinez gave up eight hits in 6 1-3 innings and tied a career-high with two singles at the plate, including one in which he beat out a throw and signaled safe to let everyone know. Martinez also scored a run.

"Carlos was terrific," Cardinals manager Mike Matheny said. "You can tell he's pitching with a lot of confidence."

His performance helped the Cardinals salvage the final game of what's been a rough series. St. Louis was outscored 15-6 in the opening two games and had slugger Matt Holliday go on the disabled list with a strained right quadriceps.

Paulsen entered as a defensive replacement in the seventh for left fielder Brandon Barnes, who appeared to hurt a leg on a slide into second. Paulsen knew a changeup was coming — he had seen a steady diet of them — and hit it into the left-center seats to make it a 3-2 game.

Randal Grichuk gave the Cardinals a little more cushion with a solo shot in the eighth.

Kevin Siegrist pitched 1 2-3 innings and struck out four, including the side in the eighth. Trevor Rosenthal threw a perfect ninth for his NL-leading 20th save in 21 chances.

Colorado was trying for its first sweep of the Cardinals since July 2010 but couldn't solve Martinez as he pitched his way out of jams. Colorado hit into inning-ending double plays in the fifth and sixth innings.

Martinez received some nifty glove work from second baseman Kolten Wong in the first with two outs and DJ LeMahieu on third. Wong made a diving snare in the outfield grass, got up and threw out Carlos Gonzalez by a step.

Martinez tapped gloves with his second baseman on the way into the dugout.

"That's a big play," Weiss said. "A lot of game left, but it's a big play."

TAKEN OUT

Daniel Descalso ran over Wong, his former teammate in St. Louis, while trying to break up a double play.

"I thought I taught him better than that — to get out of the way," Descalso said, smiling. "Guess not."

TRAINER'S ROOM

Cardinals: Matheny said the team will monitor the progress of Holliday's strained right quadriceps over the next few weeks. "He's impressive how he's able to bounce back, how his body handles certain injuries," Matheny said. ... RHP Lance Lynn went back to St. Louis for more tests after experience forearm tightness after his last start. Matheny said the team is still waiting to hear back. Lynn is slated to pitch Saturday.

Rockies: OF Corey Dickerson (plantar fasciitis) is to accompany the team to Miami and could come off the disabled list sometime during the series. Dickerson said his left foot "feels a lot better." ... Shortstop Troy Tulowitzki was given the day off.

UP NEXT

Cardinals: The team has a day off after finishing up their road swing 4-3. LHP Jaime Garcia (1-3, 2.67) will take the mound Friday as the Cardinals host the Kansas City Royals.

Rockies: LHP Chris Rusin (2-0, 1.45) throws Thursday to start a four-game series in Miami. The Marlins went won two of three when they were recently in the Mile High City.