To fully appreciate the effect of the P-51s aerodynamics:
P-51 is about a 10000 lb fighter with a full fuel load and gun ammo, no external ordnace.
Spitfire is about a 7000 lb fighter with a full fuel load and gun ammo, no external ordnance.
For any given timeframe, the Merlins in the Spitfires had an equal or better rating than the license built versions in the P-51.
So with 70% of the Spitfire's power to weight ratio, the P-51 still managed higher top speeds.
The shape of the Spitfire's wings is almost as close to the ideal as possible from an overhead plan view, particularly for lift distribution/minimal drag while pulling high g-loads: critical for low stall speeds and high turn performance. However, the profile shape used was certainly less than optimal as one approaches transonic speeds.
The Mustang's wing was optimized for low drag more than high lift. Such low drag that even being slightly underpowered compared to comparable fighters, it still had good all around performance and of course outstanding speed.
The range of the Mustang comes from low drag combined with a large fuel load (what do you think was a good part of its extra 3,000 lbs of weight

). The Spitfire barely carried any fuel at all compared to any US fighter at the time.