Kansas City threatened in the early stages of the match as Dominic Dwyer capitalised on an error by the Earthquakes' defence and raided through on goal, but his strike was well blocked by David Bingham.
San Jose pressed again and good work in the final third presented a shooting chance for Shea Salinas when he curled his strike towards the bottom corner, but Melia made the save to deny the midfielder.
The Earthquakes took the lead in the second half when Salinas raided down the right and sent a cross to the back post. Chris Wondolowski sent the ball back across the face of goal, and Godoy was there to tap the ball home in the 47th minute.
Sporting almost found an equaliser immediately as Benny Feilhaber released the run of Dwyer through the middle of the San Jose defence, but his strike was well saved by Bingham.
The visitors pushed late in the game and came close, but Mikey Lopez sent his header from close range over the bar as the hosts held out for the three points to close the gap in the playoff race in the Western Conference.