Peru beats New Zealand, earns final spot in World Cup