Haniya in turn "thanked Iran for its support," they added, days after Tehran confirmed it had supplied military aid to Gaza.
"The Iranian president congratulated the people of Gaza and the (Palestinian) resistance facing Zionist aggression ... on their great victory," Iran's news agency ISNA reported.
Haniya's office said Ahmadinejad called late on Friday to praise Gaza's "victory after eight days of Israeli aggression," referring to the Jewish state's Operation Pillar of Defence which ended with a Wednesday ceasefire.
"We stand beside the Palestinian people," the Iranian president added.
Parliament speaker Ali Larijani on Wednesday said Iran had supplied military aid to Islamist movement Hamas, which controls Gaza and which fired missiles at Tel Aviv for the first time during the eight-day conflict with Israel.
"We are proud to defend the people of Palestine and Hamas ... and that our assistance to them has been both financial and military," Larijani said in remarks reported by parliament's website, ICANA.ir.
Iran's Revolutionary Guards chief General Mohammad Ali Jafari also said on Wednesday that Tehran had provided the "technology" for the Fajr 5 missiles used to target Tel Aviv, but denied supplying the actual weapons.
He said they were being "rapidly produced" in Gaza.
Hamas leader Khaled Meshaal on Wednesday thanked Iran as well as Egypt for their support during the conflict, saying Iran "had a role in arming" his Islamist movement.
The truce ended eight days of cross border attacks in which 166 Palestinians and six Israelis died.
Iran does not recognise arch-enemy Israel and supports hardline Palestinian movements such as Hamas.