Car won't restart on hot days

Recently when I drive for a while in traffic (stop and go) and then park my car for a quick errand and try to restart it won’t start. This has only happened on extremely hot days ( over 90 degrees). I replaced the battery after the first time which was in April. It is now June and its happened 2 times in 2 weeks again. I have been able to start it after letting it sit for over an hour or with a jump. I’m getting nervous to run errands and the weather isn’t getting any cooler. Any ideas of the cause?

What do you mean, ‘it won’t start’? Does it crank and not start, or does nothing happen when you try to start? Describe what happens in as much detail as you can.

it cranks and the entire vehicle shakes but won’t turn over

Then it might be a fuel problem, maybe a weak fuel pump or a leaking fuel injector. Either would let the fuel pressure drop, allowing vapor lock (fuel boiling) to happen. A mechanic should measure the fuel pressure before replacing anything. It might also be a bad/loose connection in the ignition system that opens up when hot.

is that leak related to a defective main relay ? problems with those sounds similar to my issue

What kind of car is it?
If it is a Honda/Acura, the FI main relay would be my first suspect.

It’s a Mazda 626, right? What year?

The weak fuel pump or leaking injector problem is different than a relay problem. @RemcoW 's idea (fuel injection main relay) may be the problem here.

2000