Determine why the newel post or railing is moving. Use a stud finder or a hammer and a small finish nail to look or feel for backing. It is important to know if there is solid backing behind the wall or under the newel post. If you have access to the underside of the newel post, check to see if it is secured to the floor joists or that blocking was installed to receive the screws which hold down the newel post.
Drill a pilot hole in the railing and install a three-inch wood screw on the under side of the railing into the newel post and/or wall. The pilot hole should be slightly smaller than the size of the screw without the threads.
Secure the newel post to the floor with three-eighths-inch lag bolts from beneath. Depending on your application, you will be able to drill a pilot hole and install half-inch lag bolts through the side or straight up through the bottom of the post, which go into the post at about five inches. There must be at least one and a half-inch of backing, but three inches is better, for screwing a lag bolt up into the post.