I would like to add to the other answers the fact that the ease with which you can jump to a different field in graduate school depends on the nature of your new field. One factor to consider is how interdisciplinary your new field is. Some traditional fields, such as mathematics, physics, and to a lesser extent chemistry, have a fairly strict hierarchy in that you must take certain courses in certain order so as to understand the field. Thus it would be more difficult to convince the admission committee that you are a good fit if you have very little formal training in the field. On the other hand, fields such as biophysics, neuroscience, etc., are very interdisciplinary. Neuroscience programs, for example, will usually be happy to admit majors from math, physics, chemistry, biology, psychology and computer science, to just list a few. In this case, even if your official major is not neuroscience, your chance is not significantly worse than someone who does have a major in neuroscience (this of course also depends on your other credentials such as relevant research experience).
Another factor to consider is the structure of the Ph.D. programs in your country and in your new field. In some cases, such as biology or many European countries, you are required to select an advisor from the very beginning of the program, whereas other programs, such as in mathematics in the US, you do not have such requirements and you are admitted into the program first and select your advisor only one or two years later. In fields that require you to pick an advisor from the beginning, having a different undergrad major may be less disadvantageous if, for example, you personally know (or your advisor personally knows) the professor that you will want to work with. Alternatively, you may be better off applying to programs that do not require a specific advisor if you do not have a specific commitment in the new field.