Oxygen has an atomic number of 8, which also indicates that it has 8 electrons.

A single s subshell can only hold 2 electrons, and the remainder will fill the subshell. Therefore, the first 2 electrons go in the 1s subshell, the other 2 in 2s subshell, and the remaining 4 in the 2p subshell.

1s - 2
2s - 2
2p - 4

∴ the configuration is 1s² 2s² 2p