As you mention, your passport has no issue with immigration to Japan, then it just comes down to what you're doing there. You'll be able to show you have an exit flight from Japan, so that's fine, and that you want to just leave the airport for a few hours.
Indeed, I did this exact thing in June - I had a few more hours than you, so I had the day in Tokyo, but still - it's perfectly acceptable and common to pop out.
Depending on the time it takes you to get through customs, however (immigration took me aside for extra questioning, still not entirely sure why), you might be pressed for time. Once you get out, go up to the 3rd(?) floor - there's like a Japanese 'village' of restaurants inside the international terminal, or on the ground floor, a cheap 7-11 style place if you just want a backpacker-price meal.
Otherwise, if you have time, the Monorail will get you into town pretty promptly and cheaply - 30ish minutes to Hamamatsucho (check though, as there's an express monorail as well).