Yahoo! strongly recommends that you change your Yahoo! login password if your Yahoo! account has been compromised. We suspect that the people who compromise the security of Yahoo! accounts will use them to send spam. These unwanted messages can be sent to the contacts saved in your Yahoo! account services: Yahoo! Messenger, Yahoo! Mail, and Yahoo! Pulse.
To change your password now, follow these instructions:

Please write your password down, and keep it in a safe place for later reference. Many people forget new passwords when they change them.