Real, whose Portugal forward Cristiano Ronaldo broke his own Spanish record with his 41st goal of the campaign, came from a goal down to beat lowly Sporting Gijon 3-1 at the Bernabeu.
Two hours later Argentina's World Player of the Year Lionel Messi equalled Ronaldo's mark with both goals in Barca's 2-1 win at fifth-placed Levante in the late kick-off.
Real's victory also meant Jose Mourinho's side equalled the club's Spanish record of 107 goals scored in a season set under Welsh coach John Toshack 22 years ago.
The world's richest clubs by income are locked in one of the most exciting Spanish title races in recent years and could meet in next month's Champions League final if Real get past Bayern Munich and Barca see off Chelsea.
With five La Liga matches left, Real have 85 points. Barca, who have trimmed six points from the Madrid club's lead in the past month, are on 81, 29 ahead of third-placed Valencia.
"We suffered a lot for the victory," former Real player now club director Emilio Butragueno said in a television interview.
"It was a very tough match and they are all going to be like that between now and the end of the season."
Ronaldo's 74th-minute header at the Bernabeu broke the La Liga scoring record he set last season and he has 53 goals in all competitions.
Messi, who succeeded the former Manchester United forward as World Player and has won the award the past three years, has 63 and is only four short of the all-time record of 67 set by former Bayern Munich striker Gerd Muller in the 1972/73 season.
Real coach Jose Mourinho opted to leave striker Karim Benzema and winger Angel di Maria out of the starting line-up for the Gijon game and with central midfielder Xabi Alonso suspended, they lacked inspiration in the early stages.
They fell behind in the 30th minute when Sergio Ramos handled in the penalty area and Miguel De Las Cuevas comfortably beat Iker Casillas from the spot.
Argentina forward Gonzalo Higuain equalised seven minutes later when he rose unmarked to nod a Ramos cross past Juan Pablo before Ronaldo settled the home sides nerves and Benzema added a third from Mesut Ozil's assist eight minutes from time.
Gijon defender Roberto Canella earned a second yellow card and was sent off in the 79th minute as the Asturian club's hopes of avoiding relegation were dealt a further blow.
In Valencia, Barca also fell behind to a penalty when the referee ruled Sergio Busquets had used his arms to block a shot and Jose Javier Barkero stroked the ball past Victor Valdes for a 23rd-minute lead.
Coach Pep Guardiola threw on World Cup-winner Andres Iniesta and winger Isaac Cuenca before the prolific Messi rode to the rescue of the Spanish and European champions when he exchanged passes with Alexis Sanchez in the 64th minute and curled a shot into the corner.
Cuenca was felle
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.