Barcelona's inconsistency over the season had cost them the La Liga title, coach Luis Enrique has said.
A second half comeback from two goals down to beat Eibar 4-2 on the final day of the season proved futile as Real beat Malaga 2-0 to end a five-year run without the title.
Barca took 14 points from 18 in their six games against Spain's top four sides Real, Sevilla and Atletico. Real picked up just eight in the corresponding games.
The Catalans, however, proved less reliable against supposedly weaker opposition, dropping points against Real Betis, Real Sociedad, Celta Vigo, Deportivo La Coruna, Alaves and Malaga. Madrid took maximum points from those games.
"We haven't ended the season as we wanted. La Liga is 38 games long and it rewards consistency. We were not consistent enough," Luis Enrique told a news conference.
"Especially earlier in the season at home and we have paid for that. We didn't depend on ourselves. We fought until the very end and now we congratulate the worthy champions.
"Whoever wins the league is the worthy winner. We know where we fell short, but this is how it is in the top competitions."
Barca supporters unveiled a huge banner before the game in tribute to the coach, who spent eight seasons with the club as a player, in his last league match in charge before taking a sabbatical.
He won a treble in his first season in charge in 2014/15 and a double in his second campaign, but next week's King's Cup final against Alaves is his only chance of silverware in his final season.
"I think the team has done great things throughout the season but unfortunately the line that separates victory and defeat is very small, as we have found out," he added.
"I wish we could have kept winning trophies but there are other teams that want the same and are at the same level as us."