Toni Kroos scored a dramatic winner deep into injury time as Germany beat Sweden 2-1 to keep their World Cup hopes alive.