The 'mdls' command can do this. It's basically the command-line interface to all Spotlight metadata retrieval.
Some metadata (owner, permissions, locked, etc.) is also available via commands 'ls', 'xattr'.
If you want to search for a file by its metadata, then 'mdfind' is the way to go.