Technically, this position is governed by the basic concept of the "Outside Passed Pawn" and the winning method is to use that pawn to restrict the opposing king's ability to defend the other pawns on the board.
The purest expression of that concept is in David's answer, which is to just use the one pawn and leave the other as a Damoclean Sword dangling over the head of your opponent's king.
But, given the special case of this situation (you actually have two outside passed pawns, not just one) you could also decide play it strictly as a single g-pawn endgame, but with tempo move in hand. To do this, you would use the caterpillar's "head" (the lead g-pawn) along with your king to drive the opposing king backwards to the back rank. (While doing this, when your king moves beside your pawn, keep it to the center -- f file -- side of your g-pawn.) When that is accomplished (let's say your K reaches f3, the pawn g3 and your opponent's K goes to f1 to prevent your king from advancing in front of the pawn) you simply push the g-pawn forward to g2 and when he moves to g1 to block the advance of the pawn, then you move the rearmost g-pawn from g7 to g6, leaving your opponent the choice of getting out of the way of your lead g-pawn and letting it queen, or moving one of his other pawns and letting you create a queen from one of your other pawns.
I would probably have played it that way, simply because it seems the least complicated to me, but there are multiple winning ideas in this position, and none of them are objectively better than any other.