This is rather arbitrary, I believe, although there are areas of broad agreement. By which I mean that there are some sources which prefer one style and other that prefer another. If you are writing a newspaper article, your newspaper will no doubt have a style guide that says to do it one way, which may be different from the required style of another newspaper.
That being said, I think that the generally preferred style is as you indicate, i.e. 1 through 9 or 10 should be spelled out, but beyond that it is optional which way you do it. I've also heard it said that single-word numbers should be spelled (e.g. twenty) and multiple word numbers be in digits (e.g. 23).
Here's a couple of sources for style:
As you can see from these, there are certain areas of agreement, but also areas where there are disagreement. One says write out 1 thru 9 with letters, the other says write out 1 thru 10 with letters.
Note that they all say never start a sentence with numerals.