Knockout stage of the 2010 FIFA World Cup

Who decides that the winner of Group G plays Runners-up of Group H? Brazil may be playing Spain there.
Are these 2nd round games decided at random or is there some reasoning behind it?

Group A is paired with Group B, C with D and so on. Group winners from the one group play runners up from the other. It’s all done by alphabetical order. Which teams are in which groups to begin with was decided after qualification at random, although with a heavy element of seeding.