The ruling comes as part of Google's legal battle with Viacom over allegations of copyright infringement.
Digital rights group the Electronic Frontier Foundation (EFF) called the ruling a "set-back to privacy rights".
The viewing log, which will be handed to Viacom, contains the log-in ID of users, the computer IP address (online identifier) and video clip details.
While the legal battle between the two firms is being contested in the US, it is thought the ruling will apply to YouTube users and their viewing habits everywhere.
Viacom, which owns MTV and Paramount Pictures, has alleged that YouTube is guilty of massive copyright infringement.
Hmm. Looks like it's probably still safe enough to watch copyrighted clips (which includes fanvids and so on as well as TV shows and films) as long as you've got a dynamic IP address, but a little worrying nonetheless.
Conspiracy theory department: The chairman of the Joint Intelligence Committee ("Britain's top spy") is unconscious in hospital with an unknown illness. Curious, the fates that befall people involved with Iraq investigations and dossiers. Probably just coincidence, though.