Is this a hind leg, by any chance?
If so, it could be several things, from a ruptured ligament to a sprain to a luxating patella. Only a vet can diagnose it for you.
Keep him resting as best you can until you get to the vet, which should be very soon!
ETA: If he was holding the leg up towards his body but then used it like nothing had ever happened, I'd suspect luxating patella. You should still make a vet appointment about this, as it will happen again.
he could have pulled a muscle or something, if he is not better by tomorrow you should take him to the vet, also try feeling his leg to make sure his leg isn't broke
Sounds like it could have been a seizure. He needs to get to a vet, asap. If not your regular vet, then an emergency clinic.