Manchester City had to do it the hard way as they came from 2-0 down to beat Aston Villa 3-2 to secure the Premier League title.