Ibrahimovic, who was making his first start for Milan since January 2022, scored a penalty in first-half stoppage time to level the score at 1-1 after Udinese's Roberto Pereyra had opened the scoring in the ninth minute.
The 41-year-old Swedish striker missed his first spot-kick but was given a second chance when Udinese goalkeeper Juan Musso was penalized for encroachment. Ibrahimovic made no mistake with his second attempt, thumping the ball down the middle of the goal.
With this goal, Ibrahimovic overtook former AC Milan defender Alessandro Costacurta as the oldest scorer in Serie A history.
Costacurta had netted against Udinese in 2007 at the age of 41 years and 25 days, while Ibrahimovic achieved the feat at 41 years and 166 days.
Ibrahimovic had previously made three substitute appearances this season after being sidelined since May last year following reconstructive surgery on the anterior cruciate ligament in his left knee.
Udinese coach Andrea Sottil was sent off for his protests at the decision to award the penalty for a Jaka Bijol handball and then allow Ibrahimovic to retake the spot-kick following Marco Silvestri's brilliant save.
But the home side were back in front at the break as Beto made up for his earlier error by finishing off Isaac Success' low cross on the stroke of halftime.
In the second half, Kingsley Ehizibue sealed the victory for Udinese with a goal in the 74th minute.
The Nigerian forward was kept onside by Pierre Kalulu as he stole in at the back post to poke in Destiny Udogie's mishit shot.
The defeat was a setback for Milan in their quest for a top-four finish in Serie A, which would secure them a place in next season's Champions League.
Milan remain in fourth place with 52 points from 28 games, two points behind local rivals Inter Milan, who play Juventus on Sunday.
Udinese, on the other hand, climbed to eighth in the table with 38 points, level with Juventus and one point ahead of Bologna, who drew 2-2 at Salernitana earlier on Saturday.
In the day's first match, Monza drew 1-1 with struggling Cremonese.