Nagelsmann, whose sacking in March 2023 led to Tuchel's arrival, was tipped to return to Bayern, but has now extended his contract with Germany until 2026
With second-placed Atletico Madrid travelling to Alaves later in the day, the champions took advantage of the chance to extend their lead.
A dull match was decided by Barcelona's number 10, who lofted home a free kick after 71 minutes and slotted in from substitute Malcom's cross towards the end.
Messi, the division's top scorer with 31 goals, suffered criticism in his native Argentina after withdrawing from a friendly against Morocco because of a groin problem, but was hailed by Barcelona fans after taking them one step closer to retaining the title.