BALTIMORE — A marvelous July for Oakland was interrupted by a rookie pitcher who appears to be at his best against the Athletics.

Wei-Yin Chen struck out a career-high 12, Matt Wieters hit a three-run homer, and the Baltimore Orioles averted a three-game sweep with a 6-1 victory Sunday.

It was a rare setback for the A's, who fell to 18-4 this month and 12-3 since the All-Star break. The Athletics need to win one of their next two games to complete the best July in franchise history.

Chen (9-6) allowed one unearned run, three hits and four walks in 5 2-3 innings against a torrid Oakland team that had scored 40 runs in its previous four games. In two games this season against the A's, Chen is 2-0 with a 0.71 ERA.

"Well, he was really good. We've seen him twice and he's been good against us twice," Oakland manager Bob Melvin said. "Today, he was just throwing his fastball by us. He wasn't afraid to use it. He was throwing it to both sides of the plate and using breaking balls to keep us off balance."

Chen struck out every A's starter except No. 9 hitter Brandon Hicks.

"His fastball had good life on it. It was pretty deceptive," said Chris Carter, who fanned twice. "Halfway through, it seemed like it picked up speed. His slider and changeup were also working well."

Chen, who pitched four seasons in Japan before coming to Baltimore, set a major league record for strikeouts by a Taiwanese-born pitcher. The old mark was 10 by Chien-Ming Wang in 2007. The last time an Oriole pitcher had as many as 12 strikeouts was in July 2007, when Erik Bedard fanned 15 against Texas.

A's starter Travis Blackley (3-3) gave up five runs, six hits and a season-high four walks in five innings. He was 3-0 in six starts since June 10.

"It was kind of a rough one," Blackley said. "I just couldn't seem to find the groove. I just couldn't figure it out today. You can't be awesome every time out."

Omar Quintanilla had three hits, including a homer, to help Baltimore win for only the second time in seven games.

"This was real big. Chen came out and he did his thing," Quintanilla said. "He threw real well, and overall it was a great team effort. We've just got to keep it up."

Lew Ford, whose contract was purchased from Triple-A Norfolk before the game, went 0 for 3 with a walk in his first big league game since 2007. But the Orioles left fielder contributed a strong throw to cut down Yeonis Cespedes, who was trying to stretch a second-inning hit into a double.

After going 0 for 6 with runners in scoring position in a 6-0 loss Saturday night, the Orioles got two such hits in a four-run fourth. With runners at first and second and one out, Adam Jones doubled in a run. Wieters then ended a 1-for-31 skid with a drive into the left-field seats, only the third homer allowed by Blackley in 67 innings this season.

Baltimore added a run in the fifth when J.J. Hardy ran home on the second error of the game by Carter at first base.

Limited to one hit through five innings, the A's finally got to Chen in the sixth. Jemile Weeks walked and Jonny Gomes reached on an error by Quintanilla at second base before Cespedes hit an RBI single. After a single by Brandon Inge loaded the bases, Darren O'Day retired Derek Norris on a popup.

NOTES: Oakland obtained C George Kottaras from the Milwaukee Brewers in a trade for minor league reliever Fautino De Los Santos. ... A's OF Coco Crisp missed the game with a tight left hamstring, but RF Josh Reddick returned after missing one game with a bruised back. ... Oakland opens a 10-game homestand Monday at home against Tampa Bay. The A's are 8-2 during a stretch of 17 straight games against the AL East.