Some of the iPhone 5s sensors like the compass, accelerometer and gyroscope are not working as expected. The problem was faced by a notable number of users who noticed that even replacement devices did not fix the issue for them. It is not sure if the blame is in the hardware or the software. But these sensors seem to be way too off. It affects the use of phone for games, and for changing the orientation too. Lots of apps rely on these sensors to work effectively. Your entire iPhone experience may be disrupted by this. The blame is not in the software because iOS 7 works fine for iPhone 5 users without problems in the sensors.
Solution: Take your phone to the store for a replacement
Hardware problems can hardly be fixed on our own. The best way to solve this problem is to ask for a replacement because it appears that the hardware was not calibrated properly in the factory.