According to the transcript of "Where No Man Has Gone Before" the department heads gather on the bridge:
MITCHELL: Department heads, sir. You wanted everybody on the Bridge before we left the galaxy. Jones. SMITH: The name's Smith, sir.
SULU: Astro sciences standing by, Captain.
SCOTT: Engineering division ready, as always.
PIPER: Life sciences ready, sir. This is Doctor Dehner, who joined the ship at the Aldebaran colony.
DEHNER: Psychiatry, Captain. My assignment is to study crew reaction in emergency conditions.
So Sulu (possibly the twin brother or clone brother or something of Hikaru Sulu) is the head of the astro sciences department.
But in the briefing room scene Kirk says:
KIRK: It is my duty, whether pleasant or unpleasant, to listen to the reports, observations, even speculations, on any subject that might affect the safety of this vessel, and it's my science officer's duty to see I'm provided with that. Go ahead, Mister Spock.
So Kirk clearly says Spock is the science officer aboard the Enterprise during this episode.
Spock and Mitchell are both on the bridge when the Enterprise approaches the energy barrier:
SPOCK: Force field of some kind.
MITCHELL: We're coming up on it fast.
SPOCK: Sensor beam on.
KELSO: Sensor beam on, sir.
SPOCK: Deflectors full intensity.
KELSO: Deflectors full intensity.
SPOCK: Deflectors say there's something there, sensors say there isn't. Density negative. Radiation negative. Energy negative.
KELSO: Whatever it is, contact in twelve seconds.
KIRK: Gravitation on automatic. (consoles blow up) Emergency stations. All decks on fire alert. Neutralise controls. Kelso, put it on manual. Any radiation? Anything?
SPOCK: Negative!
KIRK: Helmsmen, take us out of here. (Dehner gets hit by an electric charge, then Mitchell) Helmsmen! (Kirk takes controls) Lateral power! (Spock takes over, Enterprise veers away) Take damage reports.
SPOCK: Damage control reports, all stations!
CREWMAN [OC]: Gravity control switching to batteries.
DEHNER: Something hit me, like an electrical charge.
PIPER: He's alive. Appears to be in shock.
CREWMAN [OC]: Engineering deck three, can you give damage report?
CREWMAN 2 [OC]: Sensor beams. Full power on the deflectors.
SPOCK: Main engines are out, sir. We're on emergency power cells. Casualties, nine dead.
CREWMAN [OC]: Gravity is down to point eight.
CREWMAN 2 [OC]: All decks, this is Bridge Engineering. Due to emergency conditions.
Much of what Spock says could be doing his duty as science officer.
But he does give orders to Kelso:
SPOCK: Sensor beam on.
KELSO: Sensor beam on, sir.
SPOCK: Deflectors full intensity.
KELSO: Deflectors full intensity.
And a little later:
KIRK: Helmsmen, take us out of here. (Dehner gets hit by an electric charge, then Mitchell) Helmsmen! (Kirk takes controls) Lateral power! (Spock takes over, Enterprise veers away) Take damage reports.
SPOCK: Damage control reports, all stations!
http://www.chakoteya.net/StarTrek/2.htm1
Calling or damage reports is something that the first officer would normally do, but Kirk has just requested damage reports and Mitchell has just been incapacitated.
My interpretation of that scene is either Spock is first officer and second in command all through he scene, or else Mitchell is first officer and second in command but is too busy with steering the ship as helmsman to do first officer stuff and then is knocked out.
I think that it is a little inefficient to have the first officer steer the ship instead of doing first officer stuff to assist the captain to command. In the first season of TNG the steering role was often assigned to either a blind lieutenant junior grade or to a fifteen year old acting ensign, not to Commander Riker. In modern merchant marines and navies the helmsman is usually an enlisted sailor.
So I believe that Spock was probably the first officer and second in command in "Where No Man Has Gone Before".