This is called social login.
Basically, facebook redirects you to google with a callback URI. Once on google you authorize facebook to access your basic information (email and name) and google redirects you back to facebook (to the callback URI from before) with a code.
Facebook then contacts google to exchange that code for a token it can use to access your information. If it can access your information on google, and the information matches the expected information, it has successfully authenticated you.
This is an overly simplified view of the process, there are some crucial steps and precautions that must be taken to make this secure.
The current state of the art protocol for social login is OpenID Connect which works on top of OAuth2.