I am Japanese and got married to an American citizen last week. I came to the U.S. with a B-2 visitor visa that expires in three weeks. I will apply for my green card next week. But I am afraid about something: After my visa runs out, will I be staying here illegally until I get the green card?
Worry no more. As soon as you file your application for a green card ("adjustment of status"), your stay in the United States becomes legal—since you are now married to a U.S. citizen. In fact, you can apply for a work permit at the same time as you turn in your Form I-485 and the rest of the application. (That's what the Form I-765 is for.) Then you'll be able to wait legally in the United States—and wait, and wait. It often takes USCIS up to a year to get to your application and call you in for your interview.
That said, there is something you may need to worry about. Did you get that tourist visa just to get married and apply for a green card in the United States? If so, that's a misuse of the tourist visa, and USCIS could deny your green card application because of it. You would probably need an attorney to help you ask for a waiver, or "forgiveness." However, if you met your soon-to-be-husband after you came as a tourist, or if you weren't sure whether you wanted to marry when you came, you should be okay.
We also need to warn readers who aren't married to U.S. citizens: If your spouse is a permanent resident (green card holder), merely having him or her submit an I-130 visa petition for you is not enough to make your stay in the United States legal. The guidance above refers only to people married to U.S. citizens, who are allowed to submit the actual green card (adjustment of status) application, which for you will be the very last stage of a long process. If you're married to a permanent resident, you'll be able to submit the full green card application only after your spouse starts the process for you by submitting an I-130 visa petition, and you spend a few years on a waiting list.
For more information on all of this, see Nolo's articles on Marriage-Based Visas and Green Cards, or pick up a copy of the book, Fiancé and Marriage Visas: A Couple's Guide to U.S. Immigration.