He didn't defeat them. He ran a guerilla war in which still the Vikings had most of England, just not Wessex and after a few unfortunate battles for viking generals, they agreed on a peace so long as each settled on their land, with Christian conversions by one of them.