1989 BMW 325i, Check Engine sign, engine hesitation: what is it?

This has never before happened with this car; the car was hesitating very badly today after driving about 10 miles, and although it got a little better the rest of the day, it still hesitates a little from
time to time, and the check engine sign comes on for a second, then goes away - comes on for a second, then goes away for a few minutes, then comes back on again, as the engine hesitates/lurches for a second or two, then runs okay again. This summer it was parked for six weeks at my mechanic, who worked on other things (rear wheel bearing); but this car needs to be driven regularly, although not too much, since it already has 175,000 miles on it. Once I picked up my car a month ago, the car was stalling/ hesitating when starting (this also had never happened before); the mechanic told me to add STP fuel system cleaner, twice, which I did, and that seemed to take care of it, and it's been running fine the last couple of weeks. I don't know if today's problem is related to the earlier one. Please help me! What could this be?
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
go to AutoZone and get a free scan of your code. the symptoms you have sound like what mine did , fix one spark plug cable bad
--
RS
2006 FLSTNI
2002 1200C
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Motorsforum.com is a website by car enthusiasts for car enthusiasts. It is not affiliated with any of the car or spare part manufacturers or car dealers discussed here. All logos and trade names are the property of their respective owners.