Facebook users will soon have a new way of knocking spammers out of legitimate accounts.

The social-networking company is rolling out a new security feature that lets users see which computers and devices are logged into their Facebook accounts, and then removing the ones that they don't want to have access.

The move addresses a growing problem on Facebook. Spammers use fake phishing sites to trick Facebook users into entering their usernames and passwords, and then they use those credentials to send spam messages to as many Facebook friends as possible.

This type of spam is often very effective because it looks like it's coming from a trusted source (a Facebook friend), and security experts say that many spammers have now developed automated programs that log into stolen Facebook accounts and send spam. Just last week, scammers used hacked Facebook accounts to spam Facebook users with bogus Free iPad offers.

In addition to knocking out spammers, this new feature also gives users a way of logging out of machines that they've recently used -- a library computer or a friend's mobile phone.

Not everyone will be able to use this new feature immediately, as it's being rolled out "gradually," Facebook said in an e-mail message. Users who have been granted the login control feature can see it by going to Account Settings and then looking for it in the Account Security Section.

There, they can see the different computers currently logged into Facebook, which browser and operating system they use and -- based on Internet Protocol information -- a guess at where they are located. With the click of a button, the user can "end activity" on any of these sessions.

Someone whose account has been hacked could use this information to confirm that her account had been compromised and then reset her password.

"It provides you with a visual indication of which devices currently have sessions open with your user profile," said Andrew Walls, research director with the Gartner analysis firm.

The feature is a follow-up to a login notification feature that Facebook introduced last May, which alerts users when different devices log into their accounts, he said.

Robert McMillan covers computer security and general technology breaking news for The IDG News Service. Follow Robert on Twitter at @bobmcmillan. Robert's e-mail address is robert_mcmillan@idg.com