Roma remained level second with Lazio, which hosts Chievo Verona on Sunday.
Also, AC Milan's four-match unbeaten run was halted by a 2-1 loss at Udinese.
On Sunday, Juventus can clinch its fourth straight title if it beats Torino in a derby and Lazio loses.
At the San Siro, midfielder Hernanes put Inter ahead 15 minutes in with a spectacular shot from beyond the area after creating some space amid several defenders.
Four minutes later, Roma forward Victor Ibarbo hit the post.
Icardi wasted a golden chance to win it for Inter when he shot high in the 84th but he made up for it a few minutes later, finding the target through the legs of defender Jose Holebas after being set up by Lukas Podolski.
Inter moved up to seventh, five points from the Europa League places.
"Now we're doing what the coach is asking of us," Icardi said. "We're fighting."
Earlier, Udinese scored twice in the second half to end a six-game winless run.
Giampiero Pinzi was left unmarked to score from the center of the area through a crowd of defenders following a corner in the 58th, and Emmanuel Badu doubled the lead in the 75th from close range, redirecting a cross following a rebound.
Filippo Inzaghi's side was completely dominated until Giampaolo Pazzini pulled one back in the 88th with a leaping header on Milan's only on-target attempt of the match.
Udinese moved up to 12th.
"We played a very ugly match," Inzaghi said. "I'm very, very angry. There are no excuses. When a squad plays like that the coach is more responsible for it than anyone else.
"I want to apologize to the president and fans," added Inzaghi, a former standout striker for Milan who is having a difficult first season as a top-level manager.