KANSAS CITY, Mo. — In 17 days without Salvador Perez, the Royals won six baseball games and lost nine. They lost 3{ games in the American League Central race, and they dropped out of a wild-card spot, and inside the manager’s office, the weeks piled up and the time felt like an eternity.

Ned Yost tried to preach patience. Tried to exercise caution. Tried to inspire optimism and resolve. But on an afternoon in Oakland eight days ago, he sat inside a clubhouse office and pondered life without his All-Star catcher.

“It seems like it’s been a year since he got hurt,” Yost said.

The Royals forged onward, of course. Backups Drew Butera and Cam Gallagher were productive. But the defense was softer and the pitching staff was erratic and a baseball team was not complete. It could not be until Perez returned.

On Tuesday at Kauffman Stadium, the Royals were whole again, securing a 3-2 victory over the Colorado Rockies. Perez stepped back into the lineup and finished 2 for 3 with an RBI double in the fourth inning. Starter Danny Duffy allowed one hit and two runs across six innings. Kansas City moved to 64-62, opening a three-game series against a National League opponent.

The return of Perez, an energy source on and off the field, injected the team with life. The good vibes appeared to transfer to the pitching staff, which tossed a team gem with their catcher back behind the plate.

The night was not without its imperfections. Kelvin Herrera loaded the bases in the ninth inning and left with an undisclosed injury before Scott Alexander came on and recorded the final out of the game.

Duffy held Colorado hitless for 52/3 innings before home-plate umpire Dan Iassogna blew a 3-2 pitch against DJ LeMahieu in the sixth, extending the inning. Moments later, Nolan Arenado hammered a two-run blast to deep center field, slicing the Royals’ lead to 3-2 and leaving the Kansas City dugout incensed.

Yet the bullpen would regroup over the final three innings, holding the Rockies scoreless and clinching the win. Mike Minor and Peter Moylan offered clean innings before Herrera logged two outs in the ninth.

But then Melky Cabrera misplayed a blooper from the bat of Jonathan Lucroy into a triple. Herrera issued two walks. And things got a little tense before Alexander coaxed a game-ending grounder to shortstop.

In some ways, though, the performance soothed concerns. In the month of August, the Royals pitching staff had posted a 6.05 ERA, the second worst mark in baseball. Most of that came with Perez on the disabled list because of a muscle strain in his right side.

In interviews over the last week, Yost sought to downplay the effect of Perez’s absence on the pitching staff. But as he sat in his office Tuesday afternoon, he acknowledged the possibility.

“I don’t know,” Yost said. “We’ll find out. Now Sal’s back. We’ll find out.”

Perhaps this was mere coincidence, but Duffy logged his best performance since July 31, striking out seven and issuing three walks across six innings. In moments, it appeared as if he might realistically chase a no-hitter. But when Arenado smashed that dream in the sixth, Yost pulled Duffy after 88 pitches.

The decision worked out nicely.

On early Tuesday, Perez arrived at Kauffman Stadium, smiling as he returned inside the clubhouse. He had been sidelined since Aug. 5 with a strained intercostal muscle in his right side. The decision to activate him on had been expected for days. Yet it became official after the veteran catcher passed a slew of final tests on Sunday and Monday, an off day dominated by a rare eclipse. (Hey, even Yost watched it from the bed of his truck.)

Perez had increased the intensity of his batting practice in recent days, testing the stability and strength of the muscle. When he swung and missed against a pitching machine in the indoor batting tunnel at Kauffman Stadium, he knew he was close.

“I don’t feel anything,” Perez said.

On Tuesday, he provided the game-winning RBI, ripping an RBI double to right-field against Rockies starter Jon Gray in the bottom of the fourth. As he cruised into second base, Perez formed a heart with his hands, placing the symbol near his chest. He looked back at the dugout and flashed his megawatt smile again.

The Royals were whole again. Their heart was back. A victory followed.