(AP) - José Iglesias, Pat Valaika and Austin Hays homered to lead the Baltimore Orioles past the Boston Red Sox 13-1 Thursday night in a struggle for last place in the AL East.

Hays, Valaika, Rio Ruiz and Ramón Urías - the Nos. 5-8 hitters - each had three of Baltimore's 18 hits as the Orioles won for just the second time in eight games. Hays also had three hits and a homer on Wednesday night.

The Red Sox had won three in a row, with a chance to tie Baltimore for fourth place in the division had they swept the series. Instead, Boston trails by two games with three games to play in the pandemic-shortened season and has clinched its worst winning percentage since the 1965 team lost 100 games.

"I know it was not the way that we were supposed to play, but we are trying to do our best," Red Sox starter Martin Perez said. "One thing that I want to say is we're never going to quit. I know it was not the best season for us, but we still have three more games, just go home, prepare our bodies for next year. We're going to have a great season next year."

Alex Cobb (2-5) gave up one run and six hits in seven innings for his first win since July 25 - the second game of the season. He had lost five straight decisions over eight starts.

"Coming off the surgery last year my goal was to get back to feeling normal this year," he said. "There was some ups and downs on that path, but I think I finally found it."

Perez (3-5) allowed six runs on nine hits and a walk in four innings; he struck out two.

"Sometimes you go out there you think you have your stuff, and it's not (there)," he said. "The way that I finished the season was not the way that I expected, but that's part of the game."

Infielder Tzu-Wei Lin pitched the ninth for Boston - his first career pitching appearance - allowing three more runs, including Hays' homer.

MANY THANKS

In the Fenway finale, the Red Sox used the center field scoreboard to thank different groups that contributed to the unusual season. Messages were posted for the technical and cleaning staffs, as well as baseball operations and even the media.

"Thank you medical team," one message read. "We made it this far because of you!"

"Thank you productions," one said. "For cheering along every play with (asterisk)(asterisk)positive reaction 2(asterisk)(asterisk)"

"Thank you players, coaches and staff," another said. "We hope you never have to spit in a tube ever again."

"Thank you to anyone we missed," the last one said. "It's probably because we have been locked inside the control room and haven't been allowed to interact with anyone for 3 months."

BIG INNINGS

Baltimore scored three in the second inning when Ruiz singled in one run and scored on Cedric Mullins' two-run double. They added three more in the fourth when Ruiz led off with a double and then Urías bounced one into the right field seats; after Urias scored on a sacrifice fly, Iglesias homered to make it 6-0.

Ruiz doubled in a run and scored in the fifth to take an 8-0 lead and then made it 9-1 on Valaika's solo homer.

"Good to see some guys having some good nights in the stats line," Orioles manager Brandon Hyde said.

BOX SCORE

Red Sox fans weren't able to visit Fenway Park this season, with all major league games off-limits to fans because of the coronavirus pandemic. But residents of Boston will be able to cast their ballots in the upcoming election at the ballpark during the first weekend of early voting, Oct. 17-18.

The Boston City Elections Commission approved Fenway Park as an early voting location on Thursday. The ballpark is one of 21 early voting locations across the city.

The state voting registration deadline is Oct. 24.

"Voting is one of the best ways to support and champion the issues and policies we value," Red Sox president Sam Kennedy said. "What better way for the Red Sox to help with that effort than to open up our ballpark for Boston residents to cast their early ballots."

TRAINER'S ROOM

Red Sox reliever Domingo Tapia was hit in the right arm by a line drive back to the mound by Urias. Tapia chased the ball as it rolled toward first base, flipped it to the bag for the force out and then lay on his stomach on the grass. He left the game, having thrown just two pitches.

UP NEXT

Orioles: Finish the season in Toronto. Pitchers TBA.

Red Sox: Chris Mazza (1-2) faces Atlanta's Kyle Wright in the opener of a season-ending, three-game series.