First officer
Aboard a starship the first officer or executive officer (or XO) was the second-in-command, just below the captain.

Duties 
In Starfleet the position was usually held by an officer with the rank of commander or lieutenant commander, but exceptions do exist, such as with Sylvia Tilly in the 32nd century. 

In Starfleet's early period of existence, the first officer would accompany the captain on landing parties, depending on the situation. By the 24th century, however, it was the first officer who usually led away teams while the captain remained on the ship.

In the 22nd and 23rd centuries, the first officer served as a department head first and the executive officer second (similar to the second officer and third officer) and only took command when the captain left the bridge, as such, there was no first officer's station as there would be in the 24th century, as the XO would alternate between the command chair and their station as a department head.

Noted functions of the first officer aboard a Federation starship were:
 The primary role of the second-in-command was to carry out the decisions of the Captain. ()
 Obey and implement the captain's orders. (; ; )
 To be informed, insomuch as to know everything the captain knew. () As well as had full security clearance to possess such knowledge. ()
 Attending important meetings and briefings with the captain. ()
 Take command of the vessel in the event of the captain's absence, incapacitation or death. (; , ; )
 To point out any actions that may be mistakes by a commanding officer. (;  , , , , )
 To safeguard the lives of the ship's crew, particularly the captain. ( )
 Act as the officer in charge of personnel. ()
 Preparing and issuing duty rosters. () 
 Following the promotion of Acting Ensign Wesley Crusher in 2364, Captain Jean-Luc Picard told Crusher, that while he waited for his acceptance into Starfleet Academy, "you will learn this ship–every operation, every function," and that Commander William Riker would prepare a duty schedule for him, "heavy on study". ()
 According to Captain Kathryn Janeway, if a member of the crew needs to leave their post, they are required to inform the first officer. ()
 Coordinate personnel transfers between departments. ()
 Working with the chief medical officer or counselor on crew evaluations, () as well as crew discipline. ()
 Supervise subordinates.
 When Hoshi Sato requested the help of T'Pol, Sato expressed her frustration with how frequently T'Pol was looking over her shoulder, double-checking her log entries, and translations. While T'Pol felt she was just doing her job, and explained how she held Sato to a high standard because "I know you're capable of achieving it." ()
 Managing the ship's resources, including systems allocation. ()

Aboard a Klingon warship, the first officer served the Captain, but stood for the crew. They also reviewed and kept the ship's record of battle. ()

Noted first officers

List of first officers

Starfleet 
Named
Sub-Commander / Commander T'Pol
 (2151–2161)

Commander Brink
 (2367)

Lieutenant Maxwell Burke
 (2370–2376)

Commander Michael Burnham
 (2256)
 (3189)

Ensign Sylvia Tilly
 (3189)

Lieutenant Commander Cavit
 (2371)

Commander Chakotay 
USS Voyager (2371–2378)

Commander Pavel Chekov
 (2285)

Lieutenant Commander Data 
USS Enterprise-D (2369) 

Commander Will Decker
USS Enterprise (2270s)

Lieutenant Ducane
 (29th century)

Commander Flaherty
 (2365)

Lieutenant Commander Christopher Hobson
 (2368)

Commander Steven Mullen
 (2167)

Lieutenant Tom Nellis
Antares (2266)

Lieutenant Commander Una Chin-Riley
USS Enterprise (2254)

Colonel Kira Nerys (Bajoran Militia liaison officer)
Deep Space 9 (2369 – 2375)
 (2371 – 2375)

Christopher Pike
USS Enterprise (2240s–2250)

Commander Jack Ransom

 Commander William Riker 
  (2361–2364)
 USS Enterprise-D (2364–2371) 
  (2365, part of the Officer Exchange Program)
 USS Enterprise-E (2372–2379)

Commander / Captain Saru
 (2256–3190)

 Commander Shelby 
USS Enterprise-D (2367) 

Lieutenant Commander Benjamin Sisko

 (2367)

Captain Spock
USS Enterprise (2266 – 2270)
USS Enterprise-A (2286 – 2293)

Lieutenant / Lieutenant Commander Worf
USS Enterprise-D (2370) 
USS Defiant (2372–2375)
 (2375)

Cristóbal Rios
 (2389)

Unnamed
 Pegasus first officer
 

 Phoenix first offcier

Klingon Empire 
Hon-Tihl
 (2369)

Kaz
 (2269)

Korax
 (2267)
 (2269)

Commander Kurn
USS Enterprise-D (2366, part of the Officer Exchange Program)

Lieutenant Commander Worf
 (2373 – 2375)
 (2375)

Other 
Human – Matthew Ryan
 (2151, demoted in August to able crewman)

Ferengi – Kazago
Bok's Marauder (2364)

Tellarite – Gaavrin
Tezra (early 22nd century)

Tygarian – Romah Doek
 Nanut

Romulan – 

 Romulan – Ayel
 Narada

Mirror universe 
Commander 
 (2155)

Lieutenant Commander 
 (2155)

ISS Shenzhou (2257)

Commander 
 (2267)

Alternate timelines 
Lieutenant Sato
Enterprise NX-01 (2165)

Commander Thelin
USS Enterprise (2269)

Commander Worf
USS Enterprise-D (2367 – 2370) 

Commander 
 (2258 – 2263)
 (2263)
 (2260s)

Commander 
USS Enterprise (2258, 2259)

Appendices

Apocrypha 
Acting First officer 
 (Desperate Hours)
Commander Jon Cooper
Starbase 47 (Star Trek: Vanguard)

Commander Sonya Gomez
USS Da Vinci (Star Trek: Starfleet Corps of Engineers)

Commander Shelby
 (Star Trek: New Frontier)

Lieutenant Commander Demora Sulu (2301 – 2311)
 (Star Trek: The Lost Era)

 Commander Christine Vale 
 (Star Trek: Titan)

Commander Elias Vaughn (2376 – 2379)
Deep Space 9 (Star Trek: Deep Space Nine (Pocket))
USS Defiant

Commander Worf
USS Enterprise-E (2380)

External link

bg:Първи офицер
de:Erster Offizier
es:Primer Oficial
fr:Premier officier
ja:副長
nl:Eerste officier
ru:Первый помощник
sv:Försteofficer
Military ranks
Titles