Both pawns are racing for the last rank. The count only looks close: their own king blocks the g-pawn, so you queen two moves ahead and then have to convert queen against pawn.