The Rossoneri had endured a chastening series of results, after a shock 2-0 defeat at Spezia was sandwiched in between a two-legged UEFA Champions League semi-final loss to cross-city rivals Inter.
With Stefano Pioli’s side in desperate need of a morale boost, it was no surprise that a dose of the feel-good factor was delivered by the talismanic Rafael Leao.
The Portugal international broke the deadlock against Serie A’s bottom club in the ninth minute, as he latched onto a brilliant lofted pass by Brahim Diaz, took a touch and opened up his body, before firing past Nicola Ravaglia.
But Milan have often flirted with disaster in recents weeks, and Fabio Quagliarella scored an unlikely equaliser for La Samp with a clinical close-range strike from Alessandro Zanoli’s cross.
With that goal, the 40-year-old has now achieved the astonishing feat of scoring in 18 consecutive Serie A seasons. The visitors' joy was short-lived though, as Giroud put Milan back in front with a fine header from Diaz's cross to end a run of six appearances without a goal in all competitions.
The Frenchman netted his second five minutes later from the penalty spot, with Ravaglia diving in the opposite direction after Koray Gunter brought down Leao in the box.
Dejan Stankovic’s side showed plenty of endeavour, only to lack the required quality to cause Milan genuine problems. This was best summed up when Mehdi Leris scuffed his shot wide after being brilliantly picked out by Quagliarella. Manolo Gabbiadini then fired an effort over the bar following some free-flowing football from the visitors.
But Milan eased to a fourth goal just past the hour mark courtesy of Diaz, who confidently swept the ball home from Sandro Tonali’s ball across the box after being picked out by Leao.
Giroud then completed his hat-trick in the 68th minute with an unorthodox finish from Leao’s cross, outmuscling Bram Nuytinck and rubbing salt into the gaping Sampdoria wounds to conclude a five-star display.
The win moves Pioli’s side to within a point of Lazio in the UCL places, ahead of their clash with Spezia on Sunday. As for Sampdoria, this defeat only prolongs an atrocious campaign that will be their worst on record in the top-flight since the switch to three points for a win, as even victory in both of their remaining two games will see the Genoa outfit fall short of their previous lowest tally of 28.