Barcelona had led Real before the league took a three-month break in March due to the coronavirus pandemic, but Real rode an impressive string of 10 straight victories after the restart to overcome their bitter rivals.
Lionel Messi, who scored Barca's lone goal in Thursday's loss, expressed his frustration on the game and his club's overall campaign.
"We didn't expect or want it to end in this way, but it's a reflection of the season in a way," Messi said after the match. "An inconsistent, weak team that is beaten in intensity and enthusiasm.
"It's been easy to score goals against us. We lost a lot of points when we shouldn't have done and have been really inconsistent."
Osasuna took the lead at Camp Nou in the 15th minute on Jose Arnaiz's right footed shot from the centre of the box to the bottom left corner. But Messi equalised it on a superb bend around the wall on a free kick in the 62nd, clipping the post past goalkeeper Sergio Herrera.
Luis Suarez, who came on as a second-half substitute, seemingly got the equaliser on a acrobatic volley in the 68th minute from Messi's pass, but the goal was ruled offside.
Barca, winners of the previous two La Liga crowns, will finish the season on Sunday against Alaves. They are back in action against Napoli on Aug. 8 in the second leg of their Champions League round of 16 clash.