World War II brought the economy out of the Great Depression. Once the war started, the government began putting people to work in factories and as soldiers. After the war, the Cold War was starting and there was a Space Race to win. There was still plenty of government spending.
Most all wars are good for the economy in that it creates jobs for people that are not fighting the war. It also created work for factories in that they had to gear up and produce goods to be used in fighting the war.