Stefano Pioli’s side had not won their last six games in the San Siro in all competitions and were playing without suspended forward Zlatan Ibrahimovic.
They needed a win with third-placed Juventus, now four points behind, at fellow Champions League chasers Atalanta later on Sunday.
“We wasted a lot, we could have finished it earlier, but the important thing is the spirit to stay in the game until the very end,” said Pioli, who has given up on catching Inter.
“Inter have taken too many points to think that we can still fight for the Scudetto (league title).
“Winning was important. We will have to face important teams, Atalanta, Juventus, Lazio, from here to the end they will all be difficult.”
Ante Rebic put Milan ahead in the 13th minute with Rafael Leao, taking the place of Ibrahimovic, missing a chance for a second minutes later.
A Mattia Destro header against his former club pulled 14th-placed Genoa level eight minutes before the break.
Mario Mandzukic came off the bench for his first appearance in over two months just after the hour and had a role in the winning goal, which Scamacca guided past his own goalkeeper from a corner.
Genoa missed a double chance to pull level again with four minutes to go when Andrea Masiello and Valon Behrami were denied by Simon Kjaer and Fikayo Tomori’s goal-line clearance to hand Milan their first home win since February 7.
The seven-time European champions are aiming to return to the Champions League for the first time since the 2013-2014 season.