Inter Milan went top of Serie A on Sunday after completing a remarkable second half comeback to overturn a two-goal deficit and beat AC Milan 4-2.
- Instant Classic: Watch replay of thrilling Milan derby
But a Marcelo Brozovic volley and Matias Vecino strike in the space of two minutes saw Inter draw level at the start of the second half, before Stefan de Vrij's header put them in front in the 70th minute.
Ibrahimovic hit the post with a late header as Milan pressed for an equaliser, but Antonio Conte's side sealed the win in stoppage time through a Romelu Lukaku header.
Inter move into first place on goal difference, after catching Juventus on 54 points following their 2-1 defeat by Hellas Verona on Saturday, while Milan are 10th with 32 points.
Conte admitted Inter can now dare to dream of the title ahead of a week that will test his team's credentials as they host Napoli in the Coppa Italia semifinal first leg on Wednesday, before travelling to third-placed Lazio on Sunday, who are one point behind them in the standings.
"It's still very early to talk about something we can only dream of for now," the Inter coach said.
"We can have a dream. It's a very intense period for us coming up and after that we'll have a better idea of our potential and our real capabilities.
"We must face important matches, starting from Wednesday's with Napoli, then Lazio, who have really strengthened over the years.
"We can't achieve everything from one day to the next, but we are building. These guys proved they have great strength and guts today."
Milan started strongly, coming close when Hakan Calhanoglu smashed a low shot off the post from outside the box. They took a deserved lead five minutes before the break when Ibrahimovic headed a lofted pass into the path of Rebic for a tap-in.
Ibrahimovic then got a goal of his own in first half stoppage time, heading in at the back post after Franck Kessie directed a corner into his path, making the Swede the oldest player to score in the famous fixture at the age of 38 years and 129 days.
However, Inter completed a stunning comeback in the space of just two minutes at the start of the second half.
Brozovic showed superb technique to guide in a volley from the edge of the area on the 51st minute, before Alexis Sanchez sprung the offside trap and pulled a pass back for Vecino to fire home the equaliser.
Conte's side completed the turnaround when De Vrij stooped to guide home a header from a corner, and substitute Christian Eriksen was inches away from scoring his first goal for the club when his long-range free kick came back off the crossbar.
Ibrahimovic powered a header off the post from point-blank range in the final minute of regulation time, before Lukaku made sure of the three points by heading in his 17th league goal of the season in stoppage time.
"We stopped playing, the team stopped believing, we stopped pressing, didn't pass it around enough," said Ibrahimovic.
"From the equaliser onwards, everything collapsed."
Inter have now won four consecutive Milan derbies in Serie A for the first time since 1983.