Khamenei made the comments today during a meeting with Khalid Mish'al, the political leader of Hamas, which emerged victorious from parliamentary elections held in Palestine on 25 January.
In the wake of Hamas's victory, Israel, which views Hamas as a terrorist organization, has been urging international donors to sever their support for the incoming Palestinian government. Israel itself is withholding customs and tax revenues from the Palestinian Authority, one of a series of punitive measures to pressure Hamas into recognizing the state of Israel's right to exist.
The United States is withholding some funding, and the EU has threatened to do likewise.
Khamenei characterized Hamas's victory as a "sweet divine surprise," saying that Palestinians had voted for Hamas as part of "the path of struggle and resistance against the Zionists [Israel]."
Iranian news agencies quote Mish'al as saying the Hamas victory "was also a victory for Iran, and Iranians should therefore be congratulated as well."