Gorillas will not attack for no reason and like most other animals will only attack if they feel themselves threatened. So don't look like a threat, and don't look like you're challenging it as a form of assertion of dominance or wanting to dominate because this will excite the animal's appetite.
Read Also: Top 10 Canadian Universities Giving Scholarship Funds
Some zoological knowledge can help here, such as you avoid eye contact, sit as far away from him as possible with as little crouch as possible, and you don't make sudden movements or loud noises. Look submissive, look non-threatening then you will survive.
Also, don't be silly with an answer stating that the gorilla is just as scared as you are and you can fight it with your strength. You definitely won't get out of this situation alive.
The following is an anatomical comparison.
Adult gorillas are about 20x stronger than the average adult male and they have been recorded to be capable of lifting and throwing loads of up to 815kg (nearly 1,800 lbs).
They also weigh about twice the average American male, with arm spans about a third longer.
So do you still think pepper spray and paring knife will stop a gorilla or you will win a fight with a gorilla? Throw away those thoughts if you still want to live.
Sit tight, still, be small, move slowly, and you may succeed.