Messi netted after 17 minutes after Karim Benzema had given Real Madrid an early lead.
The Argentine had failed to score in the teams' recent Copa del Rey semifinal series, which Madrid won 4-2 on aggregate thanks to a 3-1 victory at Camp Nou on Tuesday, but he was on target this time to draw level with his compatriot, now Real's honorary president, on 18 strikes in the famous fixture.
Di Stefano hit 18 goals for Madrid against Barca in 30 games between 1953 and 1964, but Messi has drawn level with that total in just 25 matches.
Leo, who is still only 25, is also the last player to hit a hat trick in the fixture, having netted all three of Barca's goals in the 3-3 draw at Camp Nou in 2006-07.
Follow GOAL.COM on Twitter