Cristiano Ronaldo scored early on to settle the nerves, latching onto Isco’s through ball to step around Carlos Kameni and tap into an empty net.
Karim Benzema added their second goal after the break after Kameni parried Sergio Ramos’ shot.
Real, who had only needed a point, now face Juventus in the Champions League final looking to complete a double.
Barcelona, who had won the past two titles, came from 2-0 down to beat Eibar 4-2 but they had needed Real to slip up if they were going to retain the trophy.
The result means Zinedine Zidane, in his first full season as Real boss, is the first manager to lead Madrid to the Spanish league title since Jose Mourinho five years ago.
If Real beat Juventus in Cardiff, they will become the first team to successfully defend the Champions League – with Zidane having won the tournament six months into the job last summer.
Never in doubt for Real
Real Madrid are deserved champions, having been the best team in Spain – and probably Europe – for most of the season.
Their squad is starting to look less reliant on Benzema, Ronaldo and Gareth Bale, who was out injured – even though the first two players scored their goals at Malaga.
Isco, who was impressive again, and Alvaro Morata have shown themselves to be quality players when given the chance.
When Barca beat Real in El Clasico on 23 April, it gave renewed hope for an exciting title race – but Real won their last six games to win the league by three points.
And there was never any title peril on the final day once Ronaldo rounded Kameni to score the second-minute opener.
Malaga had chances, with former Barca striker Sandro impressive. But with nothing to play for themselves, they never really looked like winning.
‘The league is everything’
Real Madrid coach Zinedine Zidane: “It was very important [to win the league]. It was a lot of years without winning it and we knew that the league is everything.
“For Real Madrid, because it is the best club in the world, we have to return with this league title.
“He [Ronaldo] is always there to make the difference and I am happy for him – it is a little different because he is always there to do it.
“It has been a difficult season that we worked hard for, with some tough moments, but after 38 games we are top and that is it.
“The Spanish league is the best in my opinion and to win it in this way is incredible – I am very happy.”
Title stats – Real end longest title drought since 1994
- Real have ended their longest run without a title (four seasons) since 1994
- Real have scored in all of their games in a single La Liga season for the first time ever
- The Whites have scored 58 goals away from home, their best return in a single La Liga season
- Real have scored in their last 64 games in all competitions, the best run by a team from the top five European leagues
- Cristiano Ronaldo is the all-time top-scorer in the top five European leagues (369), surpassing Jimmy Greaves (366)
- 19 different players have scored for Real Madrid in La Liga this season, a joint-record in Europe’s top five leagues with Celta Vigo
- Real have scored 27 headed goals in La Liga, the most for a team in a single top-flight season since at 2003-04
- Zinedine Zidane is the sixth former Real Madrid player to win La Liga as manager, after Bernd Schuster, Vicente del Bosque, Jorge Valdano, Luis Molowny and Miguel Munoz.