The right-hander struck out four and walked one in five shutout innings, leading the Giants over the visiting Pittsburgh Pirates 5-4 on Tuesday night.
He was relieved by Kyle Barraclough in the sixth after throwing 69 pitches.
"Like it was Opening Day," Cueto said.
Cueto, 33, was 3-2 with a 3.23 ERA in nine starts last season before he was shut down. He is in the fourth year of a six-year, $130 million contract.
"That was a special night for Johnny, just so much hard work and coming back from so much,'' said Stephen Vogt, who caught Cueto's comeback outing. "Getting to be a small part of that with him was pretty special for me. It's been a long road for him to come back. He was just so happy today -- before the game, during the game, after the game you could just tell he was having fun."
Cueto went 1-2-3 in the first on 11 pitches with a strikeout and two groundouts before turning his cap around just for fun and pumping his fists.
He punched his hand into his glove in celebration, chomping his gum all the while.
"That's my game, every time I pitch just try to have fun," he said.
The Associated Press contributed to this report.