Shania Twain didn't exactly have a shotgun wedding yesterday in Puerto Rico ... but it sure was a pistol -- as in what the guards were packing on the beach during the ceremony.
A guy who lives near the mansion where Twain tied the knot tells TMZ he stumbled upon the nuptials at the beach ... and was quickly shooed away by several armed security guards.
In the video you can see a guard with a pistol tucked in his belt roaming back and forth while the ceremony goes on behind him.
We're told the security was so tight, if you wanted to walk past the wedding... you had to go into the ocean to get around.
Beats getting shot.