idles too slow and smokes when accelerating on 2003 Mazda Tribute

When I am driving around 40-50 mph, the rpm's run about 1000 and it threatens to stall, and if I rev it in park, at around 4000 rpms, the engine sputters. What do you think the problem is?

Asked by for the 2003 Mazda Tribute
What you're describing, I suspect the airflow sensor.
The smoke on acceleration bothers me, what color is the smoke? Is the check engine light on when it's running? If so, there are data and trouble codes stored in the computer which could be accessed with a scanner and would be useful in diagnosing the problem.
Give me that information and I'll try to get closer to the problem.
Here's a directory link for you:
The smoke is dark, and yes, the engine light is on. Thank yOU!