Moving from an economics Ph.D. program to a job in a mainstream math department will be difficult. There will be the practical difficulties (are you able to teach as broad a range of courses?), the incentive issues ("If he's so great, why doesn't the economics department hire him instead? What's in it for us? If he's really a mathematician, why did he go to grad school in economics in the first place?"), culture clashes (mathematicians will have no idea what a working paper is, won't know whether the American Economic Review is any good, won't recognize the names of letter writers from economics or care as much about their opinions, etc.), and so on.
If you turn out to be a superstar, you'll have more flexibility, but anyone less gifted will have to work very hard to fit in. In particular, to have any real shot at this you'll have to:
(1) Demonstrate that you have a broad background in mathematics, in particular in the areas that are not used in economics. I.e., you'll need to study mathematics to the extent that nobody would guess you didn't go to math grad school.
(2) Publish papers primarily in mathematics journals. An economics paper, even a very mathematical one in an excellent journal, will count substantially less than a mathematics paper. if you have more economics papers than mathematics papers, then mathematicians who support other candidates will use this as an argument for why the economics department would be a better fit for you. (And they will convince many people by arguing that if the economics department wants you, then the math department would get the benefit of having you around for free, and if they don't want you, then maybe that's a bad sign.)
(3) Find leading mathematicians to write letters of recommendation for you. There's a widespread belief that recommenders lower their standards a little when recommending for other departments, or may not fully understand the standards or needs of these departments, so math departments will on average pay less attention to a letter from an economist than from a mathematician.
All this is unfair, but these issues are real. If you might want to work in a different department, then you should start preparing as early as possible.
P.S. You'll also run into other cultural issues. For example, economics candidates regularly get tenure-track jobs in top departments straight out of grad school, while mathematics candidates almost never do (i.e., the number of people who do this in a typical year is 0 or 1). This may work to your advantage, for example by giving you a chance to do a postdoc and improve your credentials, but it's something you'll have to deal with.