The road to war was paved by the growing tension in the area since 1963 over the issue of exploiting the waters of the Jordan River and the Kineret Lake. This led to an escalation of military clashes initiated by Syria, and to an increase of Palestinian terror attacks against Israel encouraged by Arab states, particularly Syria.
The immediate causes for the war included a series of escalating steps taken by the Arabs: the concluding of a Syrian-Egyptian military pact to which Jordan and Iraq later joined, the expulsion of the UN Emergency Force (UNEF) from the Sinai Peninsula and the concentration of Egyptian forces there, and finally the closure by Egypt of the Straits of Tiran to Israeli shipping, constituting a casus belli for Israel.
When Jordan, Iraq, Saudi Arabia, Syria and Lebanon moved their forces toward the Israeli border, Israel mobilized its reserve forces, and launched a diplomatic campaign to win international support to end the Egyptian blockade of Israeli shipping through the Straits of Tiran.
When this failed, and in reaction to Arab threats of wiping Israel out, the war began with an Israeli pre-emptive aerial strike on 5 June 1967. It ended on 10 June 1967 with Israel's victory.
Sources: Israel Ministry of Foreign Affairs