Simply accessing a website isn't going to allow the owner of that website to spy on you. However if your anti-virus and anti-malware programs aren't up-to-date then it's possible for a dodgy website to dump malware on your computer which will give remote access to your computer to unauthorised users. If that happens then, depending upon the nature of the malware, they might be able to
(a) view all the files on your computer ; and/or
(b) monitor the keystrokes on your computer (to gain passwords, etc) ; and/or
(c) turn on your webcam (without the little 'on' light illuminating), so that they can view your movements without you knowing.
However none of that is likely in the situation you describe. You probably simply tried to access a page that's only available to people logged in to Yahoo's server. You could then initially get a message that you weren't entitled to view the page, followed quickly by an invitation to log in.
If your security software is up-to-date you've got nothing to worry about.