To stabilise a clip in Final Cut Pro, select it in the timeline, open the inspector (Command-4) and click the Video button at the top. Scroll down to the Stabilization and Rolling Shutter sections and select the Stabilization checkbox. Its checkbox turns blue while Final Cut Pro analyses the clip, and the Method pop-up stays on Automatic, which picks InertiaCam or SmoothCam for you. Play the clip to check it.
If the picture also leans or wobbles in fast moves, select the Rolling Shutter checkbox as well. Both corrections work on whole clips, not on a range, so blade the shaky section off first if the rest of the clip is fine. The steps below follow Apple’s guide for Final Cut Pro 12.4.