The England defender grabbed his first City goal with a late header to add to Yaya Toure's penalty, a Havard Nordtveit own-goal and strikes from David Silva and Sergio Aguero
"It's been a long time coming to be honest," he told the club website
"I should have scored a few in previous games and it's nice to get one in a special cup.
"I thought we moved the ball well, first and foremost, and that got us the chances.
"We changed our system a bit, playing as a diamond with the front three. The overall performance was really good.
"And to get a clean sheet for us defenders, which we haven't had too many of, we're thrilled."
Aguero's 50th-minute strike moved him into third on City's all-time goalscoring charts on 154, one ahead of Colin Bell.
It was another chastening evening for West Ham, who leaked five at the London Stadium for the second time in a month.
To add to the catalogue of problems at their new home, City boss Pep Guardiola claimed the Hammers' larger pitch played into his side's hands.
"We controlled the game through the passes and the pitch and stadium helped us in this sense," he said.
"In England the stadiums are usually cramped. It looks bigger you feel like you have more time. Maybe that helped us a little bit."
It was probably the last thing West Ham manager Slaven Bilic needed to hear as the club continue to try to adapt to their new surroundings.
"I can understand that, it's a great pitch in a big stadium and you have space - but we gave them space as well," he said.
"We gave them the holes between our lines and the space behind, especially after the first goal, in the crucial 10 minutes which basically decided the game."