USAAF B-29s started bombing Japan in 1944, from China in July and the Mariana Islands in November. Similar to the strategy employed against Germany, they first targeted the Japanese aircraft industry. Though early raids were not always accurate or successful they did force the dispersal of aircraft production, the later area incendiary attacks continued the process. (The Strategic Air War Against Germany and Japan: A Memoir, Haywood S. Hansell, Jr; he includes [a Strategic Bombing Survey graph of aircraft production] (http://www.ibiblio.org/hyperwar/AAF/Hansell/img/p226.jpg)).
The capture of Iwo Jima in March 1945 allowed long range fighters to escort the B-29s, but by this time attrition had already severely weakened the Japanese air forces: "... by late spring and summer Japanese air strength in the home islands deteriorated so rapidly that bomber formations again went out unescorted" (The Army Air Forces in World War II: Volume V).
The first practice missions of the 509th Composite Group, the unit formed to drop the atomic weapons, were flown in July; "After June 26, Japanese fighters were rarely encountered in numbers (...) The JAAF was virtually powerless to react against the invaders, and it was told to keep its remaining aircraft in reserve for the final battle, expected in the autumn. Japan's industrial power had been weakened, and the means to defend its airspace was lacking." (B-29 Hunters of the JAAF, Takaki & Sakaida).
The 509th carried out several raids in July and August using "pumpkin" bombs that simulated the size and weight of the Fat Man atomic bomb. To gather data and gain experience the 509th first flew training flights around outlying islands such as Rota and Marcus Island, then from July 20th there were 18 bombing sorties of two to six Silverplate B-29s against targets in Japan, starting with Koriyama, Fukushima, Nagoka and Toyama. Only the heaviest anti-aircraft guns could threaten B-29s flying at 30,000ft, and these were in short supply; the 509th suffered no losses during the "pumpkin" missions, only one B-29 suffered minor damage.
(Based on my post from a [lengthy thread on more or less the same subject] (https://www.reddit.com/r/AskHistorians/comments/47p7ig/how_could_the_enola_gay_enter_japanese_airspace/) a few months ago that got a little messy.)