The upper house of parliament approved the legislation with an overwhelming 221-14 vote. The vote followed earlier approval by the lower house, thereby lifting a 1969 ban on military use of outer space.
The law, one of several moves in recent years by Japan to give greater freedom to its armed forces, allows the military to develop more advanced spy satellites for intelligence gathering and missile defense.
However, the law says that the space programs will have to be limited to defense only as defined in the nation's pacifist constitution. The U.S.-drafted 1947 constitution prohibits Japan from offensive warfare.
The law came with a supplementary resolution to ensure transparency and review within two years of enactment, said ruling Liberal Democratic Party lawmaker Hiroshi Okada, who chairs the upper house Cabinet affairs committee.
The law states that space programs must "contribute to establish a safe society, remove various threats to life of the people and ensure peace and safety of international society, as well as the national security of our country."
It does not specify what the programs will be used for, but the satellite network and other assets could be used for surveillance, planning and for a missile defense shield Japan is building with the United States.
The law also urges the government to beef up the budget and support for space research and development to make the industry more competitive. It also urges the government to coordinate university researchers and private institutions to promote the effort.
Under the new law, the defense minister joins a special taskforce responsible for Japan's future space projects, paving the way for the military to possess and develop spy satellites.
The space law is Tokyo's latest effort in recent years to ease controls on the military, which is euphemistically called Self-Defense Forces.
Japan upgraded the Defense Agency to ministry status last year, sent troops on a humanitarian mission to Iraq in 2004 for the first deployment in a combat zone since World War II.