Narrative:

I was cruising at 3;800 ft. Under the class B airspace on a flight plan leg from ZZZ1 to ZZZ2 that passes approximately 1.5 miles to the west of the ZZZ class D. The class B floor at this segment is 4;000 ft.; and the ZZZ class D ceiling is 3;900 ft.while proceeding along this leg; the ads-B display on my garmin G3X indicated an aircraft approaching from behind at a speed faster than my aircraft; and climbing within a few 100 ft. Of my altitude. I immediately and instinctively initiated a climbing left turn to take me away from the path of the approaching aircraft. The left turn took me briefly approximately 1/2 mile into the ZZZ airspace; initially just below the class D ceiling; and then my climb took me up through the class D 3;900 ft. Ceiling and above the 4;000 ft. Floor into the class B. I estimate my maximum altitude was 4;150 ft. For a period of less than 1 minute before airspace incursion warnings on the G3X obliged me to turn right - away from ZZZ - and down below the class B floor. I estimate I was above the class B 4;000 ft. Floor for less than 1 minute; and inside ZZZ class D also for about 1 minute.during this brief period I was watching the approaching aircraft on the ads-B display and watched the aircraft pass to the right at an estimated distance of 1 - 2 miles. Once I was back on track at a legal altitude; I contacted ZZZ tower to apologize for and explain the brief incursion; the ZZZ controller kindly confirmed there was not a problem; and that he had also seen the traffic approaching me from the rear. Rather than try to contact ZZZ3 approach in flight; I resolved to call the tower on landing. (I had to leave a voice message and intend to call again tomorrow morning.)whereas it is highly regrettable to enter controlled airspace with permission at any time; I do believe my immediate and instinctive collision avoidance maneuver was appropriate and instrumental in avoiding a potential collision. However; if such a situation arises again in the future; I would try to do a better job of determining a better action that would keep me away from controlled airspace. In this particular example; a descending right turn away from ZZZ; and keeping me below the class B; might have been a better option. The G3X does a good job of depicting the relative altitude and relative track of other aircraft; and also will display the n-number of aircraft that are fully ads-B compliant. If I remember this very sudden incident correctly; the other aircraft's n-number as not displayed; and the relative track was also not fully clear; indicating that the other aircraft was probably not yet fully ads-B equipped.

Google
 

Original NASA ASRS Text

Title: Light Sport pilot reported they violated Class D and Class B airspace to avoid a faster moving aircraft.

Narrative: I was cruising at 3;800 ft. under the Class B airspace on a flight plan leg from ZZZ1 to ZZZ2 that passes approximately 1.5 miles to the west of the ZZZ Class D. The Class B floor at this segment is 4;000 ft.; and the ZZZ class D ceiling is 3;900 ft.While proceeding along this leg; the ADS-B display on my Garmin G3X indicated an aircraft approaching from behind at a speed faster than my aircraft; and climbing within a few 100 ft. of my altitude. I immediately and instinctively initiated a climbing left turn to take me away from the path of the approaching aircraft. The left turn took me briefly approximately 1/2 mile into the ZZZ airspace; initially just below the class D ceiling; and then my climb took me up through the Class D 3;900 ft. ceiling and above the 4;000 ft. floor into the Class B. I estimate my maximum altitude was 4;150 ft. for a period of less than 1 minute before airspace incursion warnings on the G3X obliged me to turn right - away from ZZZ - and down below the Class B floor. I estimate I was above the Class B 4;000 ft. floor for less than 1 minute; and inside ZZZ Class D also for about 1 minute.During this brief period I was watching the approaching aircraft on the ADS-B display and watched the aircraft pass to the right at an estimated distance of 1 - 2 miles. Once I was back on track at a legal altitude; I contacted ZZZ Tower to apologize for and explain the brief incursion; the ZZZ Controller kindly confirmed there was not a problem; and that he had also seen the traffic approaching me from the rear. Rather than try to contact ZZZ3 Approach in flight; I resolved to call the Tower on landing. (I had to leave a voice message and intend to call again tomorrow morning.)Whereas it is highly regrettable to enter controlled airspace with permission at any time; I do believe my immediate and instinctive collision avoidance maneuver was appropriate and instrumental in avoiding a potential collision. However; if such a situation arises again in the future; I would try to do a better job of determining a better action that would keep me away from controlled airspace. In this particular example; a descending right turn away from ZZZ; and keeping me below the Class B; might have been a better option. The G3X does a good job of depicting the relative altitude and relative track of other aircraft; and also will display the N-number of aircraft that are fully ADS-B compliant. If I remember this very sudden incident correctly; the other aircraft's N-number as not displayed; and the relative track was also not fully clear; indicating that the other aircraft was probably not yet fully ADS-B equipped.

Data retrieved from NASA's ASRS site and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.