Is WordPress safe from brute force login attempts if not how can you prevent such an attack?
Yes. WordPress has all the tools and features to prevent any malicious attacks or brute force attacks on your website. All you need is to make sure you have completed these tasks given below.
Make a strong password and username for your WordPress admin login page and not only this, but the users which have been given editing permissions by you must also have strong passwords.
Having a good firewall can save you from trouble. It doesn't guarantee to eliminate brute force attacks but it can save you from malicious attacks. Make sure to have two-factor authentication or 2FA. WordPress will ask you for confirmation before login in either on your mobile or by email. There is a simple free plugin called Limit Login Attempts Reloaded which will limit the number of logins on your login page. And finally, Always keep your WordPress updated. WordPress brings all new security features on every update.