Commenter Matt Steinglass takes me to task for this claim. I suppose it depends on what you mean by ending the Great Depression.
The Great Depression indisputably ended during World War II, which is when the output gap closed. But was it causal? Like everything else about the Great Depression, it's really hard to know.
Christina Romer convincingly argues that it was ultimately monetary expansion, driven by gold flows into the United States, that ended it--but later in the decade, before the turnaround, those gold flows were driven by fears about the war that indeed eventually came. Lend-Lease represented a substantial credit expansion.
There are other non-spending factors. Commodity prices spiked in 1939 due to the war, which was good for the resource-rich American continents. American labor started leaking abroad as foreign labor markets tightened. Undoubtedly a lot of firms who made things that warring Europeans needed saw a dramatic improvement in their optimism. Our figures for the period are rather primitive, so it's harder to measure things like business confidence than it would be now.
One thing that makes the question difficult to answer is that it's hard to know when to date the beginning of the recovery. Matt prefers 1940, but argues that net exports cannot justify this as a result of war spending. (By 1941, I think, you cannot reasonably read US history and conclude that America was not defacto ramping up production for a war) But there had been another nasty recession in 1938, and recovery after recessions is unusually fast. Economies are complicated things. Absent the war, would the economy have grown in 1939 and part of 1940, then sunk back into the doldrums? I don't think we know.