The decision on Saturday, which had been widely anticipated, was announced by Hamas leader Muhammad Ghazal during a news conference in Nablus in the West Bank.
Ghazal said the decision was motivated by Hamas' desire to serve the interests of the Palestinian people.
"We are responsible to our people, not to Israel and the United States," he said. "We only fear God Almighty, not America or Israel."
Ghazal said the second Palestinian intifada against Israeli occupation effectively dismantled the Oslo agreement, making it possible for Hamas to take part in the elections.
The decision may indicate a transformation in Hamas' political thinking and means the elections will see tough competition between Hamas, a branch of the worldwide pan-Islamic movement the Muslim Brotherhood, and Fatah, the quasi-secular nationalist Palestinian movement founded by the late Palestinian president Yasir Arafat.
Hamas boycotted the last parliamentary elections in the Israeli-occupied Palestinian territories in 1995, enabling Fatah and allied groups to achieve an overwhelming victory.
However, the group recently has seen a rise in its popularity, as demonstrated in recent local elections in the West Bank and Gaza Strip.
Some Hamas leaders hope that integration into the political system will help the Palestinians in their struggle for statehood.
Palestinian political analyst Hani al-Masri has described the decision to contest the July election as "a very positive and qualitative step toward putting an end to political and administrative chaos in the Palestinian society".
Al-Masri told Aljazeera.net that Hamas' full involvement in Palestinian politics would make Palestinian democracy "vital and vigorous".
"Diversity is enrichment, and Hamas' inclusion into the system will serve the overall interests of the Palestinian people."
Fatah so far has dominated
the Palestinian Authority
However, al-Masri predicted that Hamas would not "throw its full weight" in the upcoming elections because of its "pariah status" in Israel and the United States.
Last month, a Hamas spokesman in the West Bank, Hasan Yusuf, said in an interview with Aljazeera.net that Hamas would not want to find itself in the "leadership seat".
"At this stage, we only want to be in a position to influence the leadership."
Al-Masri said Hamas was changing and becoming "more reasonable and more logical".
He cited developments such as the movement's willingness to observe an extended truce with Israel and to accept a Palestinian state within the 1967 borders.
Hamas' political role might add
pressure on Israel to withdraw
Some Fatah leaders have welcomed Hamas' decision to take part in the elections.
"This is a positive decision; it will revitalise Palestinian political life," said Jamal Shubaki, a Fatah member of parliament and former minister of local governance.
Shubaki told Aljazeera.net Hamas would have to participate in "shouldering part of the national burden," not just "win seats and vote no".
Shubaki, however, warned that unless the internal crisis within Fatah over political reforms was resolved soon, it would be difficult to hold the elections on the designated date.
He castigated the senior Fatah leadership for deciding to hold the Fatah national convention after the legislative elections, saying Fatah followers and supporters ought to elect their representatives before, not after, the polls.
Dozens of Fatah leaders at the intermediate level, including a dozen lawmakers, have resigned from the movement to protest what they describe as authoritarianism and chaos.