Barcelona's defeat and Real Madrid's win meant that the Los Blancos sealed their 34th league title.
A stoppage-time goal by Roberto Torres brought Barcelona's reign as La Liga champions to an embarrassing end as 10-man Osasuna pulled off a shock 2-1 win at the Camp Nou on Thursday while Real Madrid secured the title with a 2-1 victory over Villarreal.
Having struggled since La Liga restarted in mid-June following the coronavirus outbreak, the defeat left Barcelona on 79 points, seven behind Real Madrid with one game left.
Visitors Osasuna took the lead when Adrian Lopez set Pervis Estupinan free with a clever pass down the left, and his ball into the box was drilled into the bottom corner by striker Jose Arnaiz in the 16th minute.
Lionel Messi equalised for Barca with a sublime free kick in the 62nd minute after Luis Suarez was fouled just outside the box, but Osasuna overcame the sending-off of Enric Gallego to snatch a winner through Torres in stoppage time.