Submariner Edward Devenney has admitted collecting top secret naval codes before meeting two men he believed were Russian spies.
The Royal Navy petty officer pleaded guilty to two counts at the Old Bailey after being caught by an MI5 sting earlier this year.
Devenney, 29, from Strabane, Northern Ireland, was about to join the crew of nuclear armed HMS Vigilant when he was arrested.
Among the secrets he offered at a secret meeting were the sailing dates of two of submarines which form part of Britain's nuclear deterrent.
Devenney was also willing to supply a note about an operation carried out by his previous vessel HMS Trafalgar, the court heard.
He contacted a foreign embassy in November 2011 shortly after being told budget cuts would prevent him going on a career development course.
It is not known how MI5 became aware of Devenney's actions but the submariner had a record of indiscretion, tweeting up to 40 times a day about his duties.
In one he wrote: "Bomb Iran? Am not bothered, but I'll probably be in the submarine that fires the missiles!"
Devenney admitted collecting crypto material, believed to be computer for encoding signals, and misconduct in a public office by seeking a covert relationship with a foreign power harmful to the Royal Navy.
In return for those pleas, prosecutors agreed not to pursue a charge of communicating information to an enemy.
Devenney faces jail when sentenced next month.