My guess is it might be having nightmares or muscle spasms. I'd say keep an eye on the dog for a week or two and if it continues each night or in a pattern which you feel is too often then have the dog seen by a vet.
Dogs can dream and if you watch them their eyes are much like a humans in REM sleep (eyes going back and forth and blinking) sometimes their noses twitch, tails wag and the feet will move as if they are running. They may mumble a bark every so often. If the dog is just twitching and appears still I suggest as the above poster did that you take your dog into the vets ASAP.
NO NO, ignore the above answer, yes your pet can dream which would cause them to spasm, move, but its mainly due to REM sleep. Like humans, when dogs enter REM sleep they spasm, twitch, much like our eyes do when we enter REM sleep, except for them its not just their eyes, it can be legs, paws, body.