The fight occurred within Sora's heart, and I only say it happened in his heart because thus far the mind plays no signifigance in the series. Even memories have nothing to do with the mind but are rather more connected to the heart.
While the fight may have taken as long as any fight takes, outside of Sora's heart it only lasted a few short moments before he came back to reality. But to Sora, it was very very real.
If you play Kingdom Hearts II Final Mix, the fight is actually playable and quite epic and Sora gets a keychain afterwards that represents Roxas.
I always assumed Roxas was fighting Sora to test him, to see if Sora was really worth the possibility of fading away forever. I think Roxas wanted to make his own decision about whether or not Sora could really beat Xemnas and free Kingdom Hearts. Obviously, Sora beat Roxas so Roxas gave in and allowed himself to fully combine with Sora (I presume up until that point, Roxas was still trying to hold on to himself). This of course resulted in Sora being able to use his Final Form.
So, it was real and yet it wasn't and it was (in my opinion) a test. The end.
Take away from it what you will.