"The submarine suffered some external damage but there is absolutely no damage to her nuclear plant and no member of the ship's company was injured in the incident," the ministry said in a statement.
"We are in contact with the merchant vessel and initial indications are that it has not sustained damage," it added.
The HMS Ambush submarine was submerged and carrying out a training exercise when it collided with the merchant vessel on Wednesday afternoon.
It arrived in Gibraltar later the same day to undergo further checks, the ministry said.
The HMS Ambush has the capacity to carry a mix of up to 38 Spearfish heavyweight torpedoes and Tomahawk land-attack cruise missiles, and can target enemy submarines, surface ships and land targets with pinpoint accuracy, according to the defence ministry's website.
The submarine is a regular visitor to Gibraltar, having stopped in the territory last month and in March.
The defence ministry said there "are no safety concerns" associated with the presence of the HMS Ambush in Gibraltar, and that it has opened an "immediate investigation" into the collision.
In 2000 a British nuclear submarine, the HMS Tireless, docked in Gibraltar for repairs for nearly a year after a crack was found in a cooling pipe near its nuclear reactor, sparking fears that it could leak and contaminate the environment.
People in Gibraltar and in southern Spain staged regular protests against the HMS Tireless and it has been the subject of a high-profile direct action campaign by the environmental organisation Greenpeace.
Spain's prime minister at the time, Jose Maria Aznar, was criticised at home for not insisting that the submarine be moved back to Britain for repair.
The captain of the HMS Tireless at the time, Mike Walliker, assumed the post of Commander of British Forces in Gibraltar last week.
Britain's defence ministry did not provide details of the damage done to the HMS Ambush, saying only that "this is not a similar situation to the HMS Tireless".
A tiny enclave located on Spain's southern tip, Gibraltar has been a British territory since 1713 and is known to its 30,000 residents as "the Rock".
Gibraltar remains a source of British-Spanish tensions, with Madrid long claiming the territory should be returned to Spanish sovereignty.