In 1941, at the time of Pearl Harbor, the US economy alone was five times the size of the
Japanese. By 1945, the US economy was ten times the size of the Japanese.
The USA was also allied with the British Empire, the second biggest economy in the world (the table above underestimates British economic power because it includes the UK only and not the rest of the Empire which added approximately another 50%).
On top of that, the USA was allied with the Soviet Union, the fourth biggest economy in the world (though the Soviet Union was not at war with Japan).
Japan's only ally of note was Germany, which had the third largest economy, but as it was on the other side of the world, across oceans completely controlled by the Allies, it was in no position to help Japan.
Military prowess and momentum can carry a country only so far in war, and Japan fought bravely, but could not even approach the productive capacity of the allies.
Recognising this gulf in war making potential, the allies had a policy called 'Germany First', which meant they used between 2/3 and 3/4 of their military power against Germany. This was in recognition of the fact that Germany was much more powerful than Japan.
Despite this hobbling of the allied war effort against Japan, the Japanese Empire was on its knees by 1945.
- The Indian Army had stopped the Japanese Army on the borders of India,
- The combined allied navies had comprehensively wiped out the Japanese navy at the Battle of Leyte Gulf, despite the deployment of desperation tactics like kamikaze,
- US submarines had sunk the bulk of Japan's shipping, leaving Japan on the verge of starvation.
- US air power had destroyed large portions of Japan's cities.
Japan had recognised the war was lost and was already seeking an armistice before the bombs were dropped, though their terms were completely unrealistic.
There was a faction in the Japanese army that would have committed national suicide rather than surrender - throwing half-starved civilians armed with sticks against allied tanks.
Luckily that didn't happen, as the atom bombs and the declaration of war by the Soviet Union were enough to convince the Japanese regime that the only realistic course was unconditional surrender. So the Emperor gave his agreement to surrender, saving millions of lives.
Table from The Economics of WW2 - an overview