The present invention provides a latching mechanism for an x-ray tube assembly comprising a rotary plate, a first spring-loaded latch and a second spring-loaded latch which are disposed diametrically. The rotary plate comprises a first receiving portion and a second receiving portion spaced from each other by 90°. The first spring-loaded latch configured to be pressed removably into the first receiving portion to lock the x-ray tube assembly in a first position and the second spring-loaded latch is configured to be pressed removably into the second receiving portion to lock the x-ray tube assembly in a second position. According to the present invention, it is possible tomake manufacturing tolerance control and assembly of the x-ray imaging system much simpler and easier.