The 39-year-old reached the landmark by firing the opener into the top corner after 30 minutes, and went one better shortly after the hour.
Ante Rebic then added a late brace of his own to take his side two points clear of city rivals Inter, who had temporarily taken over on Friday night.
Ciro Immobile scored the only goal of the game as Lazio made it six league wins in a row by edging past struggling Cagliari.
Parma's problems near the foot of the table increased as they fell to a 3-0 home defeat against Bologna, for whom Musa Barrow scored a brace.
Borja Iglesias put the hosts in front in the first half but Messi needed just 14 minutes to fire the equaliser before a Victor Ruiz own goal put the visitors in command.
Ruiz scored at the right end seven minutes later, but an 87th-minute winner from Trincao proved enough to send Ronald Koeman's side back up to second place in the table.
Mikel Oyarzabal and Alexander Isak scored a brace each as Real Sociedad claimed their first win in five games with a 4-1 triumph over Cadiz, who had Marcos Lopez sent off on the stroke of half-time.
Athletic Bilbao and Valencia shared a 1-1 draw, with a Hugo Guillamon own goal putting the hosts in front before Valencia replied through Gabriel Paulista.
Ante Budimir scored a late winner for Osasuna against Eibar after Jonathan Calleri's early strike had been cancelled out by Kike for Eibar just before the break.
Jonathan David continued his fine recent form as Lille returned to the top of Ligue 1 with a 2-0 win at struggling Nantes.
David opened the scoring in the ninth minute and his second seven minutes from time secured a sixth consecutive win for Raymond Domenech's side.
Paris St Germain kept up the pressure in third place as they cruised to a 2-0 win at Marseille, extending the hosts' winless league run to six games.
Aleksandr Golovin scored a hat-trick as Monaco also kept up the pace by edging a seven-goal thriller 4-3 at rock-bottom Nimes.
Kevin Volland also got on the scoresheet for Monaco in the 77th minute but they were forced to cling on for their seventh straight win after Niclas Eliasson reduced the deficit.
Late goals from Steve Mounie and Romain Faivre saw Brest hit back from a goal down to beat Bordeaux 2-1 and inflict the visitors' third straight loss.
Two goals from Gaetan Laborde paved the way for Montpellier to see off struggling Dijon 4-2, while an early own goal from John Boye was enough for St Etienne to beat Metz.
An own goal from Souleyman Doumbia plus efforts from Myziane Maolida and Armine Gouiri helped Nice coast to a 3-0 win over Angers.