The Russian spy ship Viktor Leonov on Wednesday morning was spotted 40 miles closer to the U.S. -- and not far from a Navy submarine base in Connecticut, a U.S. official told Fox News.

SLIDESHOW: RUSSIA'S MILITARY POWER IN PHOTOS

The ship was spotted 30 miles south of Groton, Conn., but it remained in international waters. The U.S. territorial boundary extends 12 miles from the coast.

The Russian spy ship was currently “loitering” in the water, the U.S. official said.

"We are aware of the vessel's presence," said Lt. Col. Valerie Henderson, a Defense Department spokeswoman. "It has not entered U.S. territorial waters. We respect freedom of navigation exercised by all nations beyond the territorial sea of a coastal State consistent with international law."

RUSSIA DEPLOYS BANNED MISSILES, BUZZES US WARSHIP

The spy ship is armed with surface-to-air missiles, but its main function is to intercept communications and collect data on U.S. Navy sonar capability.

This was the furthest north the Viktor Leonov had ever traveled up the eastern seaboard. The Russian spy ship was last seen off the East Coast of the U.S. about two years ago, spending time near another U.S. submarine base in Kings Bay, Ga. In January 2015, the ship was seen in Havana, Cuba.

Russia is acting like it has a permission slip to expand influence, test limits of reach. Questions are obvious: does it, and if so, why? https://t.co/6Hsm7T2GO2 — Chris Murphy (@ChrisMurphyCT) February 15, 2017

The Pentagon expects the Russian spy ship to sail south along the East Coast and return to the Caribbean.

The deployment of Viktor Leonov was months in the making, Fox News was told. The ship is part of Russia’s Northern Fleet based along the Barents Sea. The ship crossed the Atlantic and made a port call in Jamaica in the past few weeks, according to officials.

The Russian spy ship's venture near the U.S. mainland follows other recent Russian provocations -- four Russian jets buzzed a U.S. Navy destroyer in the Black Sea on Friday, coming within 200 yards of USS Porter. The Russian jets had their identifying transponders turned off and ignored repeated radio calls from the American warship.

It was the first time Russian jets buzzed a U.S. warship since President Trump assumed office.

Russia was also deploying for the first time a ground-based nuke-capable cruise missile inside Russia, which violates a decades old arms treaty between Moscow and Washington.