KANSAS CITY, Mo. — Jason Hammel wrapped up his first season in Kansas City, Paulo Orlando clubbed his first home run, and the Royals pieced together a 7-4 victory on a Wednesday night that had the chill of October but none of the stakes.

In his final outing of the season, Hammel yielded three runs in six innings, his ERA settling at 5.29 after 32 starts. His performance kept his team in the game before Orlando delivered a redemptive strike in the bottom of the seventh inning and the offense dug in late.

His team trailing 3-2 in the seventh, his season marred by a demotion in April and a fractured shin that sidelined him for months, Orlando unloaded on a 2-0 curveball from Detroit reliever Drew VerHagen. The baseball soared 412 feet to deep left, bouncing into the Hall of Fame suites above the Royals’ bullpen. The two-out, two-run blast represented Orlando’s first homer since Sept. 19 of last year and flipped the score in the Royals’ favor.

Orlando may not be the definitive replacement in center field if Lorenzo Cain leaves via free agency. The club could look for other options. But the Royals have identified him as a possible internal solution. And on Wednesday, he was in the starting lineup as manager Ned Yost rested Lorenzo Cain and catcher Salvador Perez in advance of playing his regulars for three games this weekend against the Arizona Diamondbacks. In addition to the flash of power, Orlando added a terrific sliding catch in the right-center gap in the top of the first, saving two runs.

On the second night of a three-game series, Kansas City’s offense erased a 3-0 deficit and notched its second straight victory, securing the 45th come-from-behind win of the season. Melky Cabrera delivered a two-run single in the bottom of the third, scoring Whit Merrifield from first on a play that featured a smart send from third-base coach Mike Jirschele.

Hammel (8-13) settled in after allowing three runs in the opening three innings, handing the baseball to the bullpen after three more innings. The Royals (78-80) ignited for five runs in the seventh and eighth and now must win three of their last four to finish at .500 or better for the fifth straight season.

Shortstop Alcides Escobar finished with a triple and a double. Merrifield collected two more hits. And the Royals will go for a sweep tonight.

For Hammel, 35, the night offered a decent sendoff after a season that vacillated between frustrating and serviceable. On the afternoon began, the veteran right-hander sat at his locker in the corner of the clubhouse, moving boxes filling the room one day after the Royals were officially eliminated.

In some ways, it was a familiar sight. In the hours before most starts, Hammel could usually be found at a table inside the clubhouse, studying a scouting report or looking over a crossword puzzle, pencil in hand. For months, his partner in vocabulary adventures was Travis Wood, the left-handed swingman who was traded to the San Diego Padres before the trade deadline.

Hammel and Wood had both spent the 2016 season with the Chicago Cubs, helping the franchise win its first World Series championship in 108 years. Hammel was a strong fifth starter; Wood was a solid bullpen piece. And the Royals signed both to two-year contracts, hoping they would reinforce a pitching staff that sustained the tragic loss of Yordano Ventura and parted ways with Wade Davis via trade.

Wood never found comfort, posting an ERA that flirted with 7.00 before being cast off to San Diego. Hammel, meanwhile, crafted a season in which he yo-yoed between reliable and disappointing. He stumbled out of the gate in April and May. He found a groove during the late summer months, usually logging about six innings, usually giving up two or three or four runs.

By the end, you could ascribe some of Hammel’s bloated ERA to his manager’s usage. Hammel often struggled to navigate his third trip through an opposing lineup; he entered Wednesday having allowed opponents to hit .350 off him in those situations. Yet he was asked to do it more often than not.

Sometimes it worked out. Sometimes it did not. And now Hammel will return to the Royals in 2018, hoping to improve his numbers in the final season of his contract.

On Wednesday, he logged one more start. He earned the victory as the Royals prepared for the final four days of the season.