MADRID — Lionel Messi scored a hat trick to become Barcelona's all-time record goalscorer as it cut the gap on La Liga leader Real Madrid to four points ahead of their meeting next weekend with a 7-0 thrashing of Osasuna. In the process, Messi broke another record by registering his 370th Barca goal to overtake Paulinho Alcantara as the club's record marksman. Messi netted from close range to open the scoring at Camp Nou in the 18th minute. Alexis Sanchez made it 2-0 four minutes later before Andres Iniesta scored just his second goal of the season in the 34th. Messi struck twice more in the second half, either side of Cristian Tello's goal, to give him a team-leading 18 league goals this campaign, before he set up Pedro Rodriguez. Cristiano Ronaldo scored his Spanish league-leading 25th goal to give Real Madrid a lackluster 1-0 win at Malaga Saturday, when the pacesetter extended its unbeaten run to 30 matches in all competitions. Ronaldo's goal gave him 39 goals from 36 games in all competitions this season. Diego Costa made sure Atletico Madrid stayed within three points of its crosstown rivals by scoring his 22nd league goal of the season in a 1-0 win at home over Espanyol. Elsewhere, Rayo Vallecano beat Almeria 3-1 to provisionally escape the relegation zone with a third consecutive victory, while Celta Vigo earned an entertaining 1-0 win at Levante. Bayern 50 unbeaten Munich completed their 50th Bundesliga match without defeat when it beat Bayer Leverkusen 2-1 Saturday to extend its lead to an almost embarrassing 23 points. The imperious Bavarians, who have won their last 17 league games, need two more wins to wrap up the title and could even clinch it next week, with eight matches to spare, if they beat Mainz 05 and Borussia Dortmund and Schalke 04 both fail to win. — Agencies